Я использую следующий код, чтобы пользователь мог войти в Magneto с помощью AJAX. Если введено правильное имя пользователя и пароль, страница обновится и отобразит пользовательскую навигационную панель в заголовке. Поле работает в Firefox, Safari и IE, но не в Chrome. Мне нужно обновить страницу для отображения навигационной панели.`window.location.reload` не перезагружает страницу в Chrome
Зачем возникает эта проблема?
Код:
AjaxLoginForm.submit = function(button){
if (this.validator.validate()) {
// show ajax image
// button.insert({"after":osc_ajax_loading_small});
AjaxLoginForm.hideLoader();
AjaxLoginForm.insertLoader(button);
$("ajaxlogin_form").request({
onSuccess: function(transport) {
var json = transport.responseText.evalJSON();
if(json.is_forgot_pwd){
if(json.success){
$("ajaxlogin_form_message").update("<div>"+json.success_message+"</div>");
$("ajaxlogin_form_message").show();
}
if(json.error){
$("ajaxlogin_form_message").update("<div>"+json.error_message+"</div>");
$("ajaxlogin_form_message").show();
}
}else{
if(json.success){
// If the correct username and password is entered
// the page will refresh and display user navbar
// in the header
window.location.reload();
}
if(json.error){
$("ajaxlogin_form_message").update("<div>"+json.error_message+"</div>");
$("ajaxlogin_form_message").show();
}
}
AjaxLoginForm.hideLoader();
//setTimeout("AjaxLoginForm.hideResponseMessage()", 5000);
}
});
}
}.bind(AjaxLoginForm);
Попробуйте добавить параметр 'true' в параметр' reload'. https://developer.mozilla.org/en-US/docs/Web/API/Location/reload – dlopez
@dlopez Проблема не разрешается добавлением 'true' в метод' reload'. –
Кажется, что у других людей была такая же проблема, и есть некоторые способы справиться с этим. Http://stackoverflow.com/questions/11114725/window-location-reload-not-working-for-google-chrome – dlopez