jquery ajax不能在firefox用的问题, 今天解决的:
$(document).ready(function() {
$('#title').focus();
$("#xxx").click(function(){
var username1 =$('#title').val();
var pwdx =$('#content').val();
if(username1==""){
alert("题目不能为空");
$('#title').focus();
return false;
}
if(pwdx==""){
alert("内容不能为空");
$('#content').focus();
return false;
}
var aa=0;
$.ajax({
type: "POST",
async:false,
url: "/lookdata",
dataType:"html",
//如果不指定dataType,在IE中会默认为返回是HTML,但是在FF中默认为XMLDocument:[object XMLDocument]
data: "title="+username1,
success: function (jj) {
//alert("ajax 测试: "+jj);
if(jj>0){
aa=0;
alert("已存在题目【"+username1+"】");
$('#title').focus();
}else{
aa=1;
}
//alert("ajax 测试: "+aa);
}
});
if(aa==0){
return false;
}
//alert("end");
this.form.submit();
});
})
dataType, 就是这个问题,之前不能返回数据的,因为数据类型问题没有说明,现在设定了这个就可以了.