Click here to Skip to main content
15,887,326 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here I have to make call sync.In Below functions the Loop having 2 functions.I would like to execute these 2 functions one by one(synchronous call)and then go to the next loop.


Please give me a good advice
Thanks & Regards,
Soumya
C#
for (i = 0; i < per_array.length; i++) {

        $(function () {
            {
            $('input:checkbox').each(function (index, value) {
                if (this.id == per_array[i]) {
                    //alert(per_array)
                    $(this).prop('checked', true);
                    if ($(this).is(':checked')) {
                        id = this.id;

                       var para = 'title_id=' + id;

    

      mvc3prject.common.GetData('url', para, null, Fieldslist, null);

       mvc3prject.common.GetData('url', para, null, functionlist, null);


                    }

                }
            });
          
        });

    }
Posted
Comments
Kornfeld Eliyahu Peter 30-Jan-14 3:04am    
This code IS synchronous...
What's your problem?
SP HINGU 30-Jan-14 3:10am    
may this code help you

mvc3prject.common.GetData('url', para, null, Fieldslist, null).GetData('url', para, null, functionlist, null);
soumyaraj 30-Jan-14 3:25am    
Hi SP ,Thank you.But It is not helped to me

1 solution

mvc3prject.common.GetData('url', para, null, Fieldslist, null);

please explain your function definition.

in your ajax get you need to set async: false,

PHP
$.ajax({
       async: false,
       // ...
       success: function(jsonData) {
           isLoggedIn = jsonData.LoggedIn
       }
   });




also used
C#
var request = $.ajax({
  url: "script.php",
  type: "GET",
    dataType: "html"
});

request.done(function( msg ) {
  $( "#log" ).html( msg );
});




thanks
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900