Call php function in javascript without waiting for response

后端 未结 3 762
野趣味
野趣味 2021-01-29 09:03

I know how to use $.ajax. I have a Codeigniter project so I just call:

url:\'\', 

相关标签:
3条回答
  • 2021-01-29 09:24

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

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

    0 讨论(0)
  • 2021-01-29 09:26

    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){    
        }
    });
    
    0 讨论(0)
  • 2021-01-29 09:45

    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

    0 讨论(0)
提交回复
热议问题