在此代碼中Ajax
未被識別,但其他jQuery方法或選擇器正常工作。未識別Ajax
new Ajax.Request(form.action,{
method: 'POST',
postBody: params,
onSuccess: function(response) {
var responseText = response.responseText || '[]';
var json = responseText.evalJSON();
if (json.success) {
alert("json.sucess")
onSuccessfulLogin(form.j_username.value);
}
else if (json.error) {
alert("json.error")
$("form").enable(document.ajaxLoginForm);
}
else {
alert("responseText"+responseText);
$("form").enable(document.ajaxLoginForm);
}
}
});
我需要添加一些其他庫或jar嗎?我正在使用jquery 1.7.2
。
更改'new Ajax.Request(form.action,{...'to'$ .ajax({'... http://api.jquery.com/jQuery.ajax/ – sdespont
如果我的答案解決了您的問題問題請將其設置爲答案,如果不能編輯您的問題並提供更多詳細信息,請點擊這裏 – Gabriel