ajax不想工作

时间:2011-06-07 19:55:31

标签: php ajax

<script type="text/javascript">
function reportPost(args, id) {
var reason = prompt("Reason");
  if (reason == null || reason == "") {
    return false;
}
$.ajax({
type: "POST",
url: "testajax.php",
data: "reason=" + reason + "&" + args,
success: function(msg) {
    var reportSpan = document.getElementById('report' + id);
        reportSpan.parentNode.removeChild(reportSpan);
}
});
}
</script>

<span id="report<?php echo $pid ?>"><a href="#" onclick="reportPost('post_id=<?php echo $pid ?>', <?php echo $pid ?>);return false;" rel="nofollow"><img src="exclamation.png"   alt="Report" /></a></span>

我在ajax.php中的所有内容是:

mysql_query("INSERT INTO reports (message) VALUES ('test')");

没有任何内容插入到该表中,而且我连接信任我

1 个答案:

答案 0 :(得分:0)

首先,您说“ajax.php”中的所有内容都是该命令,但您的脚本是针对testajax.php。