我正在尝试使用带有CI的jquery表单提交但我无法从php文件中获取返回值。
$(document).ready(function($){
$("#submit_btn").click(function(){
var response = $.ajax({
type: "POST",
url: "send_email.php",
data: $(commentForm).serialize()
}).responseText;
.......
here i want to get value return from PHP so that i can print that value
like bellow
.......
$('#commentForm').html('<h5>Thanks</h5>'+here is result from php);
return false;
});
});
答案 0 :(得分:1)
在ajax完成后显示消息
$.ajax({
type: "POST",
url: "send_email.php",
data: $(commentForm).serialize()
}).done(function( msg ) {
$('#commentForm').html('<h5>Thanks</h5>'+msg);
return false;
});