ajax代码:
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; $.<strong>ajax</strong>({ type:'get', url:'http://a.com/app.php', data:{username:username,email:email,mobile:mobile}, cache: false, dataType:'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('timeshow').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('timeshow').innerHTML = count; ojj=setTimeout(function(){Prompt()},1000); } }, error : function(e) { //console.log(e); //有值 } });
app.php 文件
header("Access-Control-Allow-Origin: *");//首先允许跨域访问,如果是*代表所有的地址都可以访问如果只能是某个地址访问则直接写地址 写全地址http开头的地址。
json_encode($str)
以上就介绍了ajax 跨域提示 重新载入页面以获取源代码,包括了ajax方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号