add beforeunload bind

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9326 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
devjin 2011-09-26 06:35:54 +00:00
parent 7e9ce0d622
commit 7dff220d13

View file

@ -277,6 +277,7 @@ $.exec_xml = window.exec_xml = function(module, act, params, callback_func, resp
if($.isFunction(callback_func)) callback_func(ret, response_tags, callback_func_arg, fo_obj); if($.isFunction(callback_func)) callback_func(ret, response_tags, callback_func_arg, fo_obj);
} }
$(window).bind('beforeunload', beforeUnloadHandler);
// 모든 xml데이터는 POST방식으로 전송. try-catch문으로 오류 발생시 대처 // 모든 xml데이터는 POST방식으로 전송. try-catch문으로 오류 발생시 대처
try { try {
$.ajax({ $.ajax({
@ -302,6 +303,9 @@ $.exec_xml = window.exec_xml = function(module, act, params, callback_func, resp
try{ try{
console.log(msg); console.log(msg);
}catch(ee){} }catch(ee){}
},
complete : function() {
$(window).unbind('beforeunload', beforeUnloadHandler);
} }
}); });
} catch(e) { } catch(e) {
@ -349,6 +353,10 @@ function arr2obj(arr) {
return ret; return ret;
} }
function beforeUnloadHandler(){
return '';
}
/** /**
* @brief exec_json (exec_xml와 같은 용도) * @brief exec_json (exec_xml와 같은 용도)
**/ **/
@ -357,6 +365,7 @@ $.exec_json = function(action,data,func){
action = action.split("."); action = action.split(".");
if(action.length == 2){ if(action.length == 2){
if(show_waiting_message) $(".wfsr").html(waiting_message).show(); if(show_waiting_message) $(".wfsr").html(waiting_message).show();
$(window).bind('beforeunload', beforeUnloadHandler);
$.extend(data,{module:action[0],act:action[1]}); $.extend(data,{module:action[0],act:action[1]});
if(typeof(xeVid)!='undefined') $.extend(data,{vid:xeVid}); if(typeof(xeVid)!='undefined') $.extend(data,{vid:xeVid});
@ -371,6 +380,9 @@ $.exec_json = function(action,data,func){
if(data.error > 0) alert(data.message); if(data.error > 0) alert(data.message);
if($.isFunction(func)) func(data); if($.isFunction(func)) func(data);
} }
,complete : function(){
$(window).unbind('beforeunload', beforeUnloadHandler);
}
}); });
} }
}; };
@ -383,6 +395,7 @@ $.fn.exec_html = function(action,data,type,func,args){
action = action.split("."); action = action.split(".");
if(action.length == 2){ if(action.length == 2){
if(show_waiting_message) $(".wfsr").html(waiting_message).show(); if(show_waiting_message) $(".wfsr").html(waiting_message).show();
$(window).bind('beforeunload', beforeUnloadHandler);
$.extend(data,{module:action[0],act:action[1]}); $.extend(data,{module:action[0],act:action[1]});
$.ajax({ $.ajax({
@ -395,6 +408,9 @@ $.fn.exec_html = function(action,data,type,func,args){
self[type](html); self[type](html);
if($.isFunction(func)) func(args); if($.isFunction(func)) func(args);
} }
,complete : function(){
$(window).unbind('beforeunload', beforeUnloadHandler);
}
}); });
} }
}; };