Jquery Post 不调用页面
早上好!
我有一个用户登录页面“/Account/Login.aspx”,它使用自定义 我添加了一个标签,供用户重置密码 - 忘记密码?
我的帖子不会调用我的页面“/Account/LoginMethods.aspx”(没有断点触发),而是将结果返回为用户登录页面“/Account/Login.aspx”的全部内容 html
<script language="javascript" type="text/javascript">
function ConfirmPasswordChange() {
$("#ConfiormPasswordReset").dialog({
modal: true,
autoOpen: false,
autoResize: true,
title: "Reset Password",
draggable: true,
buttons: {
'Cancel': function () {
$(this).dialog("close");
},
'Continue': function () {
SendNewPassword();
}
}
}).dialog("open");
$('#ConfiormPasswordReset').focus();
}
function SendNewPassword() {
$.post("/Account/LoginMethods.aspx", { UserEmail: $("#UserName").val() },
function (result) {
alert(result);
});
$('#ConfiormPasswordReset').dialog("close");
}
</script>
知道可能的问题吗?
Good morning!
I have a user login page "/Account/Login.aspx" which uses a custom
I've included an tag for the user to reset their password - <a href="javascript:ConfirmPasswordChange();">Forgot Password?</a>
My post doesn't call my page "/Account/LoginMethods.aspx" (No breakpoint firing), but instead returns the result as the entire content of the user login page "/Account/Login.aspx" html
<script language="javascript" type="text/javascript">
function ConfirmPasswordChange() {
$("#ConfiormPasswordReset").dialog({
modal: true,
autoOpen: false,
autoResize: true,
title: "Reset Password",
draggable: true,
buttons: {
'Cancel': function () {
$(this).dialog("close");
},
'Continue': function () {
SendNewPassword();
}
}
}).dialog("open");
$('#ConfiormPasswordReset').focus();
}
function SendNewPassword() {
$.post("/Account/LoginMethods.aspx", { UserEmail: $("#UserName").val() },
function (result) {
alert(result);
});
$('#ConfiormPasswordReset').dialog("close");
}
</script>
Any Idea of the possible problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的
LoginMethods.aspx
页面可能会拒绝请求,并重定向回Login.aspx
,因为您缺少凭据。当您发出 AJAX 请求时,XmlHttpRequest 透明地遵循重定向,因此它会吐出最终重定向到的任何内容。It's likely that your
LoginMethods.aspx
page is rejecting the request, redirecting back toLogin.aspx
because you're lacking credentials. When you make an AJAX request, XmlHttpRequest transparently follows redirects, so it'll spit out whatever it finally ended up being redirected to.