Home  >  Article  >  Web Front-end  >  Synchronization issues of post and get in jquery

Synchronization issues of post and get in jquery

巴扎黑
巴扎黑Original
2017-07-03 10:31:431349browse

Solution 1:

In global settings:

##JsCode

  1. $.ajax

    Setup({

  2. async :

    false

  3. });     

Then use the post or get method


##Js code

    $.get(
  1. "register/RegisterState"

    , {test : 12},function(data, status) {

  2. if (status == "success") {

    ##      data = eval(
  3. "("
  4. + data +

    ")");

    aDataSet = data;
  5. alert(
  6. "data is "
  7. + aDataSet);

    }
  8. else

    {

    alert(
  9. "wrong"
  10. );

    }
  11. });
  12. Solution 2:

Use $.ajax directly, such as


Js code

$.ajax({
  1. type:
  2. "post"
  3. ,

    :
  4. "Register/RegisterState"
  5. ,

    Data:
  6. "Test ="
  7. + TES

    async :

    false
  8. ,
  9. ## success : function

    (data){
  10.            data = eval("("

    + data +
  11. ")"
  12. );

    ##                                                                                                                                                          

The above is the detailed content of Synchronization issues of post and get in jquery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn