1

这是我的代码,几个月前运行良好:

$.getJSON("php/loadSites.php", function(result){

            console.log("LOADING QUERY...");

            $.each(result.Sites, function(i,v){

                site_list_array.push('<li class="site" id='+v.Site.plant_code+'> <b> '+v.Site.plant_code + '</b> ' + v.Site.city +'</li>');  //build small array for the sidebar
            sites.push(v.Site); // build large array of all site data
        });

            $('#site_list').html(site_list_array.join('')); // dynamically update the webpage with the results of the query
        });

...今天出于某种原因,它只是无法执行?(它甚至不会在控制台日志中显示“加载查询”行。)它不会抛出任何错误消息......它似乎只是忽略了 $.getJSON 调用中的所有内容。

唯一改变的是我将服务器更新到 Mac OS 10.8。还有人经历过这个吗?

4

1 回答 1

2

加载浏览器的开发工具(Chrome 和 Safari 中的 CMD+OPT+I,如果我记得的话,Firefox 中的 Firebug 为 F12)切换网络 [work] 选项卡并重新加载您的页面。检查是否正在请求 loadSites.php,以及它是否返回错误。

如果您的 PHP 脚本抛出错误,您的回调将不会被调用,这可能就是您所看到的。

于 2012-09-20T22:44:18.930 回答