Jquery多个ajax调用

我有一个列出的字母导航,我试图在用户点击一个字母时从不同的json文件调用演员和导演。 我使用了2个ajax调用来从actor.php和director.php获取数据。 它在我的本地计算机上运行正常,但只有第一个在服务器上运行。 我如何让每个ajax调用工作?

$(document).ready(function(){ $('.letters').click( function(){ var letter=$(this).html(); $.ajax({ url: 'actor.php?harf='+letter, dataType: 'json', success: function(JSON) { //some code } }); $.ajax({ url: 'director.php?harf='+letter, dataType: 'json', success: function(JSON) { // some code } }); }); }); 

如果你这样做会发生什么:

 $.ajax({ url: 'actor.php?harf='+letter, dataType: 'json', success: function(JSON) { //some code $.ajax({ url: 'director.php?harf='+letter, dataType: 'json', success: function(JSON) { // some code } }); }); }); 

堆叠2个ajax调用背靠背不是我会冒的风险。

它从web浏览器加载director.php?harf = xxx时加载。 当我试图获得带有2个ajax调用的2个json文件时,第二个ajax调用不起作用。

  $.ajax({ "type": "POST", "dataType": 'json', "contentType": "application/json; charset=utf-8", "url": "../webmethods.aspx/UpdateNextFollowUpForMultipleInvoice", "data": "{'strIds':'" + strIds + "','dtNextFollowUp':'" + dtNextFollowUp + "'}", "success": function () { } });