HTML端:
//获取咨询数据
var request = $.ajax({
url: "index.PHP?m=&c=index&a=getzixuninfo&infoid="+infoid,
type: "GET",
dataType: "html"
});
request.done(function(msg) {
$("#con").html(msg);
});
PHP端:
$datastr.="<li class='title' id='title'>".$zixun['rec_title']."</li>";
foreach($data as $v)
{
$datastr.="<li class='zxli'>";
$datastr.="<p class='zxlip'>";
$datastr.=$v['rec_reply_userid']>0?'我:':$zixun['rec_name'].":";
$datastr.=$v['rec_content'];
$datastr.="</p>";
$datastr.="<span id='zxtime' class='zxlispan'>".date('H:s',$v['rec_addtime'])."</span>";
$datastr.="</li>";
在function中增加参数项
error: function(XMLHttpRequest,textStatus,errorThrown) { alert(XMLHttpRequest.status); alert(XMLHttpRequest.readyState); alert(textStatus); },
原文链接:https://www.f2er.com/ajax/164013.html