Ajax cross-origin prompt re-load the page to get the source code

Source: Internet
Author: User
: This article mainly introduces the ajax cross-origin prompt re-loading the page to obtain the source code. if you are interested in the PHP Tutorial, refer to it. AjaxCross-Origin prompt re-load page to get Source Code ">

AjaxCode:

Var mobile = document. myform. b1.value; var email = document. myform. b2.value; var username = document. myform. b3.value + document. myform. b4.value; var count = 10; var ojj; $.Ajax({Type: 'GET', url: 'http: // specify false, Ype: 'jsonp', jsonp: 'callback', jsonpCallback: "success_jsonpCallback", success: function (e) {if (e = 'Reg _ OK ') {$ ("# reg_fail "). addClass ('ldisplaynone'); $ ("# reg_ OK "). removeClass ('ldisplaynone'); $ ("# popup" ).show().css ("height", $ (window ). height (); count --; if (count <= 0) {closePopup (); return;} document. getElementById ('Times '). innerHTML = count; ojj = setTimeout (function () {Prompt ()}, 1000);} else {$ ("# reg_ OK "). addClass ('ldisplaynone'); $ ("# reg_fail "). removeClass ('ldisplaynone'); $ ("# popup" ).show().css ("height", $ (window ). height (); count --; if (count <= 0) {closePopup (); return;} document. getElementById ('Times '). innerHTML = count; ojj = setTimeout (function () {Prompt () }, 1000) ;}, error: function (e) {// console. log (e); // value }});

App. php file

Header ("Access-Control-Allow-Origin: *"); // Allow cross-Origin Access first, if it is *, all the addresses can be accessed. if it can only be accessed by a specific address, write the address starting with the full address http directly.

Json_encode ($ str)

The above introduces the ajax cross-origin prompt re-load the page to get the source code, including ajax content, hope to be helpful to friends interested in PHP tutorials.

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.