How to manage a redirect request after JQuery's Ajax call

Source: Internet
Author: User

1Successfunction(data) {2   if(data.xx = = "XX")3   {  4   //code ...5Window.location.href = "Success.aspx";6   }7   if(data.xx = = "ss")8   {9   //Code:Tenwindow.location.href= "Failed.aspx": One}

You can use JSON to judge the returned data, if the JSON data is returned successfully, what kind of JSON data will be returned, and then the if code can customize the link.

PHP notation

1  $data= ' {' Data ': ' 1 '} '; 2  Echo $data;

Note:

"Top.location.href" is the outermost page jump
"Window.location.href", "location.href" is this page jump
"Parent.location.href" is a page jump on the previous level.

The location is a property of the Window object, and all the objects under the page are in the window scope chain (this is the top-level scope), so you can omit window when you use it. The top is a pointer to the top-level window object, and the parent is a pointer to the Window object.

How to manage a redirect request after JQuery's Ajax call

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.