jquery 中post 、get的同步问题

/

解决方法1:

在全局设置:

  1. $.ajaxSetup({
  2. async : false
  3. });

然后再使用post或get方法

  1. $.get("register/RegisterState", {test : 12}, function(data, status) {
  2. if (status == "success") {
  3. data = eval("(" + data + ")");
  4. aDataSet = data;
  5. alert("data is " + aDataSet);
  6. } else {
  7. alert("wrong");
  8. }
  9. });

解决方法2:

直接使用$.ajax,如

  1. $.ajax({
  2. type : "post",
  3. url : "register/RegisterState",
  4. data : "test=" + test,
  5. async : false,
  6. success : function(data){
  7. data = eval("(" + data + ")");
  8. aDataSet = data;
  9. }
  10. });

Reproduced please indicate the author and the source, and error a link to this page.
text link: //v2ci.com/46.html