JS结合Ajax获取function的返回值,求教,该怎么解决
展开全部
function jQuery_send_data(url,s,scbf,encode_fg){
if (1==encode_fg){s=encodeURI(s);}//encodeURIComponent(s)
var c=url.indexOf("?")==-1?"?":"&";
url+=c+"rand="+Math.random();
$.ajax({
type: "POST",
async:true,
cache:false,
url:url,
data:s,
contentType:"application/x-www-form-urlencoded",
complete:function(XMLHttpRequest, textStatus){
alert(XMLHttpRequest.responseText);
},
success:function(data,textStatus){/*alert("success")*/},
error:function(XMLHttpRequest, textStatus, errorThrown){/*alert("$.ajax执行错误!\r"+errorThrown)*/}
});
}
if (1==encode_fg){s=encodeURI(s);}//encodeURIComponent(s)
var c=url.indexOf("?")==-1?"?":"&";
url+=c+"rand="+Math.random();
$.ajax({
type: "POST",
async:true,
cache:false,
url:url,
data:s,
contentType:"application/x-www-form-urlencoded",
complete:function(XMLHttpRequest, textStatus){
alert(XMLHttpRequest.responseText);
},
success:function(data,textStatus){/*alert("success")*/},
error:function(XMLHttpRequest, textStatus, errorThrown){/*alert("$.ajax执行错误!\r"+errorThrown)*/}
});
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询