거대한 webapplication에서 양식 제출을위한 해결 방법이 필요합니다.자바 스크립트 표준 함수를 제출 덮어 쓰기
내장 된 javscript 메소드를 재정의하기 위해 this example을 시도했지만 경고 팝업도 표시되지 않습니다.
이function submit(event) {
var target = event ? event.target : this;
$.ajax({
url: target.action,
data: $('form').serialize(), // &nd someone knows how I can get the serialize() of the form I just clicked?
success: function (data) {
alert('done');
},
error: function (data) {
alert('error (check console log)');
console.log(data);
}
});
//this._submit();
return false;
}
(가) 모든 곳에서 사용되는 전송 방식이 일치하지 않습니다 : 제출 덮어 쓰기 기능을위한
내 생각이있다. 원래 코드의 가능성 :
<button onclick="form.submit">
onclick="calltoFunction();" // where inside the function the submit is called
<button type="submit" // the normal way
이전에 js-function을 덮어 썼기 때문에 제 생각에 가능합니다. 그러나 제출 부분을 어떻게 처리해야합니까? 모든 제안, 아이디어, 수정 사항을 환영합니다!
아약스 기능에는 ** type ** attr이 없습니다! – Jai
나는 ajaxsetup에서 그렇게한다. 언급하지 않아서 미안해. 또한 그 attr을 함수에 넣는 것으로 시도했지만 결과는 없습니다. – user1469734