var coordinates = (function() {
var result;
$.ajax({
type:'POST',
url:'api/api.php',
dataType:'json',
async:false,
success:function(data){
result = data;
}
});
return result;
})();
console.log(coordinates);
var coordinates = (function() {
var result;
$.ajax({
type:'POST',
url:'api/api.php',
dataType:'json',
async:false,
success:function(data){
result = data;
}
});
return result;
})();
console.log(coordinates);
本文标题:获取ajax里success里的变量值为全局变量
本文链接:https://www.haomeiwen.com/subject/tgbkxctx.html
网友评论