Php jqueryajaxurl问题
我已经环顾了很多地方,似乎绝对URL是这里的发展方向。我在chrome上没有问题,但是firefox和IE仍然希望完全重定向到错误的页面 我国:Php jqueryajaxurl问题,php,javascript,jquery,Php,Javascript,Jquery,我已经环顾了很多地方,似乎绝对URL是这里的发展方向。我在chrome上没有问题,但是firefox和IE仍然希望完全重定向到错误的页面 我国: <script type="text/javascript"> $(function() { $('#page_submit').click(function () { event.preventDefault(); $('.standard span').hid
<script type="text/javascript">
$(function() {
$('#page_submit').click(function () {
event.preventDefault();
$('.standard span').hide();
var pw = $("input#pw").val();
if (pw == "") {
$("span#pw_err").show();
$("input#pw").focus();
return false;
}
var pw2 = $("input#pw2").val();
if (pw2 == "") {
$("span#pw2_err").show();
$("input#pw2").focus();
return false;
}
if (pw != pw2) {
$("span#match_err").show();
$("input#pw2").focus();
return false;
}
var data = 'pw=' + pw + '&pw2=' + pw2;
$('.standard input').attr('disabled','true');
$('.loading').show();
$.ajax({
url: "/members/includes/change.php",
type: "GET",
data: data,
cache: false,
success: function (html) {
//hide the form
$('#pw_form').fadeOut('slow');
//display results
$('#pw_form_result').fadeIn('slow');
$("#pw_form_result").html(html);
}
});
return false;
});
});
</script>
$(函数(){
$(“#第_页提交”)。单击(函数(){
event.preventDefault();
$('.standard span').hide();
var pw=$(“input#pw”).val();
如果(pw==“”){
$(“span#pw#err”).show();
$(“input#pw”).focus();
返回false;
}
var pw2=$(“输入#pw2”).val();
如果(pw2==“”){
$(“span#pw2_err”).show();
$(“输入#pw2”).focus();
返回false;
}
如果(pw!=pw2){
$(“匹配错误”).show();
$(“输入#pw2”).focus();
返回false;
}
变量数据='pw='+pw+'&pw2='+pw2;
$('.standard input').attr('disabled','true');
$('.loading').show();
$.ajax({
url:“/members/includes/change.php”,
键入:“获取”,
数据:数据,
cache:false,
成功:函数(html){
//隐藏表格
$('pw#u form')。淡出('slow');
//显示结果
$('pw#u form_result').fadeIn('slow');
$(“#pw#u form_result”).html(html);
}
});
返回false;
});
});
我试图访问的文件的结构是:
www.site.com/members/includes/change.php
不知道真正的原因是什么。我知道jquery启动器正在工作,因为我可以调用函数本身的警报调用
编辑
评出
event.preventDefault()
它似乎运行正常?我以前读过的所有东西都说这是一篇必要的文章
$('#page_submit').click(function () {
应该是
$('#page_submit').click(function (event) {
所以这个代码
event.preventDefault();
可以生效
以及“返回错误;”是unneccesarry。您没有事件变量,并且已经返回false,因此event.preventDefault()是unneccesarry