jquery ajax post get请求结果赋予全局变量

重点是要关闭 异步加载,即要:async : false,

var obj={};

$.ajax({ 
		type : "post", 
		url :url, 
		data : {i:'465461132'}, 
		async : false, //重点
		dataType:'json',
		success : function(res){ 
			obj = res.data;
		} 
	}); 

猜你喜欢

转载自blog.csdn.net/qq_29712303/article/details/87876755