0

I have a listed navigation with letters and i am trying to call the actors and directors from different json files when the user clicked a letter. I used 2 ajax calls to get the data from actor.php and director.php. It works fine on my local machine, but only the first one works on server. How can i make each ajax calls working?

$(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     }
     }); });  });
3
  • is the second one calling but failing or never being called, what debugging have you done? Commented Apr 4, 2010 at 22:20
  • 1
    if you try and load director.php?harf=xxx on the live server from a web browser (ie not within an Ajax call) does it load? Commented Apr 4, 2010 at 22:42
  • Mehmet, rather than answering your own question twice you should update/respond to your question with comments. I would recommend deleting your two responses in this question thread. Also, don't forget to vote up/accept Pointy's answer. Commented Apr 5, 2010 at 13:13

3 Answers 3

3

What happens if you do this:

$.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
       }
     });
   });
});

Piling up 2 ajax invocations back-to-back is not something I would risk.

Sign up to request clarification or add additional context in comments.

Comments

0

it loads when i load director.php?harf=xxx from web browser. just the second ajax call doesnt work when i try to get 2 json file with 2 ajax call.

Comments

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


            }
        });

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.