getJSON async with get - jquery
getJSON async with get - jquery
我有一个getJSON非常大,而这加载文档中的所有数据,我怎么能做读取其他getJSON数据,而这还在加载?
.on(中的事件被检测到,但是getJSON没有,只有当另一个getJSON被加载时才会被检测到。
$.getJSON('./master-list.php?q=master', function(data) {
$.each(data, function(i, item) {
if(i >= 120)
return false;
addServer(item);
});
});
$(document).on('click', '.servergetid', function() {
console.log('Hey!');
$('#pd').html('');
$.ajax({
url: './data.php?ip=' + $(this).data('server') + '&data=l_by_id',
dataType: 'json',
type: 'GET',
async: true,
success: function(data) {
$.each(data.players, function(i, item) {
$('#pd').append('<tr><td>' + item.Nickname + '</td><td>' + item.Score + '</td></tr>');
});
}
});
});
function addServer(ip)
{
var response = false;
$.getJSON('./data.php?ip=' + ip + '&data=info', function(data)
{
response = addServerInfo(data, '[x]');
});
return response;
}
算了吧,解决方案是将async: true更改为async: false,谢谢。
相关文章:
- 在发布后调用jQuery Get
- Codeigniter JQuery在JQuery.get请求后动态加载视图中的数据
- 错误Jquery.$.get()请求
- PHP $_GET with jQuery $.get call
- JQuery - get(0) undefined
- jQuery $.get() JSON 函数正在执行,但不会产生任何结果
- Jquery $.get() 在 javascript 中操作由查询产生的数据
- jQuery$.get从物理客户端站点返回403
- limit jquery get text();只收集10个字符
- jQuery.get()访问控制只允许某些资源出现原始错误
- Jquery get element
- jquery $.get 警告 Sync XMLhttpRequest 在主线程上使用简单的 HTML
- jQuery get HTML value
- 为什么我的PHP函数没有由jQuery $.get执行
- jquery get neighbor html value
- 如何从 jQuery Get 获取响应标头位置
- 获取 jQuery get().done() 函数的返回值
- JQuery $.get 返回对象
- jQuery get 属性在点击时
- 如何在多 Jquery Get 函数中等待