将ajax返回值提出
$.ajax({
type:"POST",
url:APP+"/Mb-broadcast",
cache: false,
data:{username:username,content:txtMsg},
success: function (rs) {
id=rs;
alert(id);
},
error: function () { alert("对不起,连接服务器出错了");}
});
var blogitem = CreateBlogItem(txtMsg,id);
这样写的话,第一次不执行 var blogitem = CreateBlogItem(txtMsg,id);
我想将ajax返回的rs提到外面来使用,怎么实现啊,求助