jquery ajax无法获取返回值
functionperson(id,shehui){varb="";$.ajax({type:"POST",url:"shehui_save.cshtml",data:"...
function person(id, shehui) {
var b = "";
$.ajax({
type: "POST",
url: "shehui_save.cshtml",
data: "action=" + shehui + "&id=" + id,
success: function (msg) {
b = msg
alert(b); //这里可以
}
});
alert (b) //(不行)无数据
} 展开
var b = "";
$.ajax({
type: "POST",
url: "shehui_save.cshtml",
data: "action=" + shehui + "&id=" + id,
success: function (msg) {
b = msg
alert(b); //这里可以
}
});
alert (b) //(不行)无数据
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询