0
내가 개체 내에서 jQuery forms plugin을 사용하고 있습니다에 컨텍스트를 전달하는 플러그인이 :jQuery를 양식은 예를 들어, 요청 및 응답
var myObject = {
el : $('#form'),
init : function() {
var options = {
beforeSubmit: this.submitRequest,
success: this.submitResponse,
error: function(xhr, reply, error) {
}
};
this.el.ajaxForm(options);
},
submitRequest : function(formData, jqForm, options) {
//this no longer contains the el attribute or access to any other myObject properties
console.log(this);
},
submitResponse : function() {
}
};
당신은 그게 this.submitRequest
를 부르고 beforeSubmit, 경우에서 볼 수 있지만, 그 함수 내에서, myObject의 컨텍스트를 가져올 수 없습니다. 컨텍스트를 전달하거나 myObject의 다른 속성에 액세스하는 방법에 대한 아이디어가 있습니까?
감사합니다.
완벽! 고맙습니다 :) – dzm