вот javascript Code: $('#active_1').click(function() { var checked = this.checked; var current = this.value; if (checked == true) { var xhr; if (window.XMLHttpRequest){xhr = new XMLHttpRequest();} else if (window.ActiveXObject){xhr = new ActiveXObject("Msxml12.XMLHTTP");} var url = "../classes/com.hoqo.view.customer/KundPoi.php?checked=" + escape(checked) + "&value=" + escape(current); xhr.open("GET", url, true); xhr.send(null); xhr.onreadystatechange = function(){ if (xhr.readyState == 4){ if (xhr.status >= 200 && xhr.status < 300){document.getElementById('rightText').innerHTML = xhr.responseText} } } } alert (current); alert(checked); }); вот файд KundPoi.php Code: $checked = $_GET[checked]; $current = $_GET[current]; switch($current){ case active_1: require('some_file.html'); break; default: print("No NO NO<br>"); } но оно не как не риагирует. алерты выводит. а с php как будто не связываеться. и конечно нечего не всятавляет. подскажите что не так .
А зачем вам в скрипте Code: xhr.open("GET", url, true); xhr.send(null); xhr.onreadystatechange = function(){ этот код? В jquery аякс уже есть - $.post(), $.get(), $.ajax()
Эмм,ну если ты юзаешь jQuery,то почему бы тебе не юзаить и ЕГО модуль ajax? $.ajax() думаю с ним траблов не буит...гугли
переделал так Code: <script type="text/javascript" > $('#active_1').click(function() { <!--var id = document.getElementById(id);--> var checked = this.checked; var current = this.value; var name = this.name; var right = document.getElementById('rightText'); if (checked == true) { $.ajax({ type: "POST", url: "../classes/com.hoqo.view.customer/KundPoi.php", data: "checked=checked&value=active_1&name=name", success: function(msg){ alert( "Data Saved: " ); } }); } alert (current); alert(checked); alert(name); alert(right); }); все = 0 реакции у него на этот файл. алерты выводит а сам файл не обрабатываеться причем jquery работает т.к $('#active_1').click(function() срабатывает. и путь к файлу 100% правильный .
сделал так if (checked == true) { alert(hello); $.ajax................................................... этот alert оно не выводит ранее var checked = this.checked; и аlert который внизу выводит true . почему оно может не быть = true
все = нечего не работает помогите разобраться я уже закоментил весь ajax решил по частям. так самое интересное что оно сразу не работало потом после n перезагрузок страницы заработало и теперь снова не работает. все пути правильные 100% . подскажите что не так чтобы оно хоть alert-ы выводило Code: $('#active_1').click(function() { var checked = this.checked; var current = this.value; var name = this.name; var right = document.getElementById('rightText'); alert(checked); if (checked == true) { alert('hello'); alert (current); alert(name); alert(right); });
хм,а скобки в конце тоже сами удаляются? }); замени на }}); в function(){ и if(){ ты открыл-то 2 скобки,а поставил одну! и вобще,в консоль ошибок смотреть нужно изредка...