<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')");
Ничто не вставлено в эту таблицу, и я подключен, поверьте мне