第3个回答 2012-12-26
js页面
$.ajax({
async: false,
cache: true,
type: "GET",
url:"a.php",
data:{},
error: function(XMLHttpRequest, textStatus, errorThrown) { alert(XMLHttpRequest + "," + textStatus + "," + errorThrown); },
timeout: 6000,
success: function(msg) {
if(msg=="true")
{
alert(成功了);
}else
{
.........
}
},
complete: function() {
}
});
php 页面
echo "true";
第4个回答 推荐于2016-06-18
$.post(xxx.php,{参数},function(data){
alert(data);
})
xxx.php
....
echo "helloworld"
...
OK 了 既然用jQuery就用封装好的 $.ajax 不用那么麻烦 $.post就完事了 比$.ajax省事多了本回答被提问者采纳