0
아약스를 사용하여 페이지에로드 된 양식이 있습니다. 양식은 malsup jquery 양식 플러그인을 사용하여 제출됩니다.디버깅 할 때 JQuery ajax 양식 제출이 작동하지만
비정상적으로이 메소드에 방화 도움말 중단 점 라인이나 경고를 추가 할 때 양식이 작동하지만 경고 또는 디버그를 제거하면 제출 코드가 실행되지 않습니다.
function addAttachment(attachmentType, path){
var typeSplit = attachmentType.split(":");
if(path == null){
path = "";
}
var url = "/add/" + typeSplit[0] + "/" + typeSplit[1];
addOverlayDivs(); //adds div to load the form into
// load the form
var snippet = $('#overlay').load(url, function(response, status, xhr) {
if (status == "error") {
var msg = "Sorry but there was an error: ";
$("#overlay").html(msg + xhr.status + " " + xhr.statusText);
}
});
var prefix = typeSplit[0];
var type = typeSplit[1];
//this alert will cause the submit form to work
alert("bind overlay called");//if I comment this out the formsubmit doesn't work
var options = {
target: null, // target element(s) to be updated with server response
beforeSubmit: showRequest,
success: showResponse,
url: "/add/" + prefix + "/" + type,
type: "POST",
dataType: "json"
};
$('#overlayForm').submit(function() {
$(this).ajaxSubmit(options);
// always return false to prevent standard browser submit and page navigation
return false;
});}
나는 $ (document) .ready를 사용해 보았지만 아무런 차이가 없다.
아이디어가 있으십니까?
당신은 대답으로 솔루션을 추가해야합니다 시도하고 오히려 질문을 추가하는 대신, 스스로 동의합니다. – Matt