前台JScript code .ajaxValidator({ type : "GET", url : "http://w406750.s182.ufhosted.com/stylist_module/register.php?callback=?", datatype : "jsonp", jsonp: 'callback', success : function(callback){ alert("Data load:"+callback.modify); $("#result").html(callback.modify); if(callback.modify == null ) { return true; } else { return false; } }, buttons: $("#button"), error: function(){alert("服务器没有返回数据,可能服务器忙,请重试");}, onerror : "该用户名不可用,请更换用户名", onwait : "正在对用户名进行合法性校验,请稍候..." });
后台PHP code $usernames = trim($_GET['username']); //获得用户名 //$result = 1; //$result1 = 2; if ($usernames) { if ($user->checkUserName($usernames)) { //查询数据库用户名是否存在 $result=$uesrnames; } else { $result=$usernames; } $k = $_GET['callback']; echo $k."({modify:".json_encode($result)."})";exit; //return; }我现在按他们说的用跨域传递来做,存在用户名显示出来,没有的话就显示null,但还是在别人机子上面错误,而我本机可以指点下。。
后台PHP code $usernames = trim($_GET['username']); //获得用户名 //$result = 1; //$result1 = 2; if ($usernames) { if ($user->checkUserName($usernames)) { //查询数据库用户名是否存在 $result=$uesrnames; } else { $result=$usernames; } $k = $_GET['callback']; echo $k."({modify:".json_encode($result)."})";exit; //return; }我现在按他们说的用跨域传递来做,存在用户名显示出来,没有的话就显示null,但还是在别人机子上面错误,而我本机可以指点下。。
ff chrom正常
加上这句看下
url : "http://w406750.s182.ufhosted.com/stylist_module/register.php?callback=?timestamp=" + new Date().getTime(),和这
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">,真是晕死,到底问题出在哪里,我也测试了好久都没解决