Skip to content Skip to sidebar Skip to footer

Call Php Function In Javascript Without Waiting For Response

I know how to use $.ajax. I have a Codeigniter project so I just call: url:'', This is all ok but ajax waits for the re

Solution 1:

You can use the following for sending asynchronous request with additional parameters.

$.ajax({
    type: "POST",
    url: url,
    data: data, // additional parameters async:true,
    success: function(response){    
    }
});

Solution 2:

If you want the request to be synchronous, set async:false. For post, type:POST

Refer http://api.jquery.com/jQuery.ajax/

Solution 3:

Do you can try this ? Change the (alert) function with your function

  $.ajax({
            url: 'test.html',
            async: false,
            success: function () { alert('hello people from the world'); }
        });

Never use async: false. Since Javascript runs on the UI thread, an async: false request will freeze the browser until the server replies

Post a Comment for "Call Php Function In Javascript Without Waiting For Response"