我只是无法摆脱困境。我需要在我的php文件中写入什么来返回$.post
函数?如何将一个php值返回给jQuery post
<script type="text/javascript">
function SubmitToDatabase(uName, uComment)
{
$.post("write_something_to_mysql_b.php", {name: uName, comment: uComment});
return false;
}
</script>
这个工作,但也有从PHP文件
这与PHP无关;这是AJAX请求的异步性质的基本属性; http://stackoverflow.com/questions/562412/return-value-from-function-with-an-ajax-call – Matt
阅读[jQuery.post()](http://api.jquery.com/jQuery .POST /)。有很多实例。 – SeanWM
使用完整的回调...如注意在文档中阅读如何去做 – charlietfl