0
<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')");
沒有被插入到該表,我連我的信任
應該「testajax.php」爲「/testajax.php」嗎? – Trey 2011-06-07 19:58:02
通常的配方:ff&firebug,啓用NET,查看請求和/或javascript錯誤。 – Wrikken 2011-06-07 19:59:40
返回任何錯誤? – Neal 2011-06-07 20:00:03