0
我想提交一個表單使用jjRoutes在Ajax後首先使用jQuery表單驗證插件進行驗證輸入。問題是,當我將「data:form」添加到ajax調用的參數時,響應處理程序從不會被調用。一些代碼進一步解釋問題:ajax提交表單在播放框架
jsRoutes.controllers.Application.authenticate().ajax({
data : {
form : this //this messes things up!
},
success : function(data) {
window.location = "/"; //never called with the above data stuff
},
error : function(err) {
alert(err); //never called with the above data stuff
}
});
我能夠讀取控制器中的表單域。當然,一種解決方案是將表單中的每個字段手動提取到數據部分(如下所示),但這不是期望的。還有其他解決方案嗎?
data : {
username : <username from form>
password : <password from form>
},
謝謝!那正是我想念的東西!); – 2012-08-12 12:11:29