我有Ajax登录表单,它检查给定的凭据是否正确并重定向到另一个页面。登录表单本身是通过HXR调用构建的 - 它不是在登录页面代码中构建的。Ajax登录表单 - 浏览器不会保存密码
问题是我无法让浏览器提示记住密码。一旦我有Firefox提示,但由于表单是由XHR调用构建的,Firefox并没有将这些值粘贴到表单中。
PS。我在登录成功时使用mootools(Form.send)和通常的window.location。 PSS。登录页面的地址始终相同。
下面的代码是由XHR一个元素(我使用MochaUI)中加载: 的JavaScript:
$('loginwindow_form').set('send', {
"url": "auth/ajax_login",
"method": "post",
"onRequest": function() {
$("loginWindow_spinner").show();
},
"onComplete": function (response) {
$("loginWindow_spinner").hide();
},
"onSuccess": function (responseText, responseXML) {
window.location = "appinit";
},
"onFailure": function (xhr) {
MUI.notification('onFailure');
}
});
$("loginwindow_form").addEvent("submit", function (e) {
!e || e.stop();
$('loginwindow_form').send();
});
XHTML(可注意到该表单没有已提交按钮 - 该按钮在其他地方,有的onclick动作来发送与给定的ID的形式):
<iframe src="auth/blank" id="blankiframe" name="blankiframe" style="display:none"></iframe>
<form action="appinit" method="post" name="loginwindow_form" id="loginwindow_form" class="standardform" target="blankiframe">
<input type="text" name="email" class="input text" id="loginwindow_form_email" />
<input type="password" name="password" class="input text password" id="loginwindow_form_loginwindow_form_password" />
</form>
发送按钮(在另一个,XHR加载,元素):
<button class="button" action="{sendForm: 'loginwindow_form'}">
<div class="accept">Login</div>
</button>
你可以发布你的代码吗? – kjy112 2011-03-05 03:35:44
我也在寻找解决方案。你找到了吗? – denislexic 2012-08-31 00:56:48