jquery ajax get example

后端 未结 4 1041
独厮守ぢ
独厮守ぢ 2020-12-16 15:51

At the moment I\'m using the post method like this

$.ajax({
    type: \"POST\",
    url: \"Servicename.asmx/DoSomeCalculation\", 
  data: \"{param1ID:\"+ par         


        
相关标签:
4条回答
  • 2020-12-16 16:04

    There is a "async" flag for making the ajax call synchronous or asynchronous. You can define it as:

    $.ajax({ async: false/true, //rest of code });

    0 讨论(0)
  • 2020-12-16 16:07

    You can decide if you want the ajax call to be async or not using this:

    $.ajax({
      async: false/true,
      //more options
    });
    
    0 讨论(0)
  • 2020-12-16 16:07

    To answer your first point, no: GET and POST are independent of synchronous / asynchronous.

    You can use the boolean async method to control this.

    0 讨论(0)
  • 2020-12-16 16:09

    look this sample maybe help you

     xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
      {
      document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
      }
      }
      xmlhttp.open("GET","ajax_info.txt",true);
      xmlhttp.send();
    
    0 讨论(0)
提交回复
热议问题