: 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.