jquery ajax get example

断了今生、忘了曾经 提交于 2019-11-29 03:41:40

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

$.ajax({
  async: false/true,
  //more options
});

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

You can use the boolean async method to control this.

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

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();
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!