前台:
$.formValidator.initConfig({formid:"form1",onerror:function(msg){alert(msg)},onsuccess:function(){
return true;}});
$("#username").formValidator({onshow:"请输入用户名",onfocus:"用户名至少3个字符,最多30个字符",oncorrect:"该用户名可以注册"}).inputValidator({min:5,max:30,onerror:"你输入的用户名非法,请确认"}).regexValidator({regexp:"username",datatype:"enum",onerror:"用户名格式不正确"})
.ajaxValidator({
type : "GET",
url : "http://w406750.s182.ufhosted.com/stylist_module/register.php?jsoncallback=?",
datatype : "jsonp",
cache:false,
success : function(callback){
alert(callback.modify);
if(callback.modify == null )
{
return true;
}
else
{
return false;
}
},
buttons: $("#button"),
error: function(){alert("服务器没有返回数据,可能服务器忙,请重试");},
onerror : "该用户名不可用,请更换用户名",
onwait : "正在对用户名进行合法性校验,请稍候..."
});
后台
/*
* 用户进行验证
*/
$usernames = trim($_GET['username']); //获得用户名
if ($usernames) {
if ($user->checkUserName($usernames)) { //查询数据库用户名是否存在
$result=$uesrnames;
} else {
$result=$usernames;
}
$k = $_GET['jsoncallback'];
echo $k."({modify:".json_encode($result)."})";exit;
}问题:$k = $_GET['jsoncallback']; 为什么它不会返回一个像jsonp1276229008805({modify:"2010-05-21"})中的这个jsonp1276229008805随机字符,可是在IE内核的浏览器都不行,用w3sc浏览器如FF就没问题了,像这种跨域传递怎么解决才好
?也不是缓存的问题,郁闷很久了,高手请教!!!!!!!!!!!!
$.formValidator.initConfig({formid:"form1",onerror:function(msg){alert(msg)},onsuccess:function(){
return true;}});
$("#username").formValidator({onshow:"请输入用户名",onfocus:"用户名至少3个字符,最多30个字符",oncorrect:"该用户名可以注册"}).inputValidator({min:5,max:30,onerror:"你输入的用户名非法,请确认"}).regexValidator({regexp:"username",datatype:"enum",onerror:"用户名格式不正确"})
.ajaxValidator({
type : "GET",
url : "http://w406750.s182.ufhosted.com/stylist_module/register.php?jsoncallback=?",
datatype : "jsonp",
cache:false,
success : function(callback){
alert(callback.modify);
if(callback.modify == null )
{
return true;
}
else
{
return false;
}
},
buttons: $("#button"),
error: function(){alert("服务器没有返回数据,可能服务器忙,请重试");},
onerror : "该用户名不可用,请更换用户名",
onwait : "正在对用户名进行合法性校验,请稍候..."
});
后台
/*
* 用户进行验证
*/
$usernames = trim($_GET['username']); //获得用户名
if ($usernames) {
if ($user->checkUserName($usernames)) { //查询数据库用户名是否存在
$result=$uesrnames;
} else {
$result=$usernames;
}
$k = $_GET['jsoncallback'];
echo $k."({modify:".json_encode($result)."})";exit;
}问题:$k = $_GET['jsoncallback']; 为什么它不会返回一个像jsonp1276229008805({modify:"2010-05-21"})中的这个jsonp1276229008805随机字符,可是在IE内核的浏览器都不行,用w3sc浏览器如FF就没问题了,像这种跨域传递怎么解决才好
?也不是缓存的问题,郁闷很久了,高手请教!!!!!!!!!!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货