Why does the browser send a request but the page does not jump

Source: Internet
Author: User
The page stays on this page. If you jump to this page, you should go to this page {code ...} {code ...} this is buyorder. PHP file {code ...} the result is that the browser wants to buyorder. php? Actlist sends a request, but the page does not jump

The page stays on this page

If you want to jump to this page

Function check () {var rec_id_Array = new Array (); $ ("[name = 'checkboxes']: checked "). each (function () {rec_id_Array.push ($ (this ). val () ;}); listTable. split (rec_id_Array, "Are you sure you want to split the ticket?", "split_order", {$ order_mode});} listTable. split = function (id, cfm, opt, order_mode) {if (opt = null) {opt = "split";} if (confirm (cfm) {Response. addHeader ("Access-Control-Allow-Origin", "http://segmentfault.com /"); var args = "act =" + opt + "& id =" + id + "& order_mode =" + order_mode; Ajax. call (this. url, args, this. listCallback, "GET", "JSON ");}}

This is the buyorder. php file.

Elseif ($ _ REQUEST ['act '] = 'split _ Order') {... header ('location: buyorder. php? Act = list'); // After redirection, subsequent code will not be executed exit ;}

The result is that the browser wants to buyorder. php? Act = list: the request is sent, but the page is not redirected.

Reply content:

The page stays on this page

If you want to jump to this page

Function check () {var rec_id_Array = new Array (); $ ("[name = 'checkboxes']: checked "). each (function () {rec_id_Array.push ($ (this ). val () ;}); listTable. split (rec_id_Array, "Are you sure you want to split the ticket?", "split_order", {$ order_mode});} listTable. split = function (id, cfm, opt, order_mode) {if (opt = null) {opt = "split";} if (confirm (cfm) {Response. addHeader ("Access-Control-Allow-Origin", "http://segmentfault.com /"); var args = "act =" + opt + "& id =" + id + "& order_mode =" + order_mode; Ajax. call (this. url, args, this. listCallback, "GET", "JSON ");}}

This is the buyorder. php file.

Elseif ($ _ REQUEST ['act '] = 'split _ Order') {... header ('location: buyorder. php? Act = list'); // After redirection, subsequent code will not be executed exit ;}

The result is that the browser wants to buyorder. php? Act = list: the request is sent, but the page is not redirected.

When you submit a page in Ajax mode, PHP cannot control the page Jump at this time. It can only be that Js obtains the page return value, and then jumps to the page through Js.

Yes, I agree with @ youming's statement.

Your request is sent using Ajax. If you want to jump through the browser, you can only return to JS where you want to jump and use it by JS.location.

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.