AJAX,没有收到任何回复

时间:2013-08-14 09:06:59

标签: php javascript mysql ajax

 if(isset($_GET['delete'])) {
$ID = $_GET['delete'];
echo "
<script type='text/javascript'>
    var ajax = new XMLHttpRequest();
    var ajax.open('POST','parser.php', true);
    ajax.setRequestHeader('Content-type','application/x-www-form-urlencoded');
    ajax.onreadystatechange = function () {
        if(ajax.readyState ==4 && ajax.status == 200) {
            alert(ajax.responseText);
        }
        }
        ajax.send('delete=$ID')
    </script>
    ";
}

这是我的代码,它应该将id发送到parser.php

这里是parser.php

    <?php

if(isset($_POST['delete'])) {
    echo $_POST['delete'];
}

没有收到来自parser.php的回复,有人可以帮忙吗? 所有答案都非常感谢

0 个答案:

没有答案