我想回来StudentId
在其他地方使用scope of the $.getJSON()
j.getJSON(url, data, function(result)
{
var studentId = result.Something;
});
//use studentId here
我想这与范围界定有关,但它似乎并不以同样的方式工作c# does
它的工作方式似乎不一样
c# 做
要完成类似于 C# 的作用域,请禁用异步操作并将 dataType 设置为 json:
var mydata = [];
$.ajax({
url: 'data.php',
async: false,
dataType: 'json',
success: function (json) {
mydata = json.whatever;
}
});
alert(mydata); // has value of json.whatever
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)