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

Synchronization issues of post and get in jquery

巴扎黑
Release: 2017-07-03 10:31:43
Original
1372 people have browsed it

Solution 1:

In global settings:

##JsCode

  1. $.ajax

    Setup({

  2. async :

    false

  3. });     

  4. Copy after login
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. Copy after login
  13. 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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template