first commit
This commit is contained in:
219
js/jquery-ajax-call.js
vendored
Normal file
219
js/jquery-ajax-call.js
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
// $.ajax Call : Parameter( call URL, request Param, call success data(html) append Target, call Method, callback Function);
|
||||
|
||||
var ajaxResponse = null;
|
||||
var homeURL = "../../";
|
||||
|
||||
function ajaxCall(url, obj, target, method, func, exceptionfunc, errorfunc){
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: method,
|
||||
data: obj,
|
||||
success: function(response, textStatus, jqXHR){
|
||||
//alert("textStatus: "+textStatus+"\n jqXHR : "+jqXHR+"\n response : "+response);
|
||||
if(target){
|
||||
$(target).html(function (index, html){
|
||||
if(response == ""){
|
||||
$(location).attr('href', homeURL);
|
||||
return "";
|
||||
}
|
||||
return html = response;
|
||||
});
|
||||
}else{
|
||||
//console.log("target If Scope : "+response);
|
||||
}
|
||||
|
||||
if(func){
|
||||
if(target){
|
||||
eval(func);
|
||||
}else{
|
||||
if(typeof response == "object"){
|
||||
//console.log("func If Scope [object] : "+response);
|
||||
ajaxResponse = response;
|
||||
eval(func);
|
||||
}else if(typeof response == "string"){
|
||||
if(response == "success"){
|
||||
//ajax Call Success~!
|
||||
//console.log("response : "+response);
|
||||
eval(func);
|
||||
}else if(response == "1"){
|
||||
//ajax Call Success~!
|
||||
//console.log("response : "+response);
|
||||
eval(func);
|
||||
}else if(response == "0"){
|
||||
//ajax Exception~!
|
||||
//console.log("response : "+response);
|
||||
if(errorfunc){
|
||||
eval(errorfunc);
|
||||
}else{
|
||||
alert("exception...");
|
||||
}
|
||||
}else if(response == "2"){
|
||||
//ajax Exception~!
|
||||
//console.log("response : "+response);
|
||||
if(exceptionfunc){
|
||||
eval(exceptionfunc);
|
||||
}else{
|
||||
alert("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><DFBB>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>.\n<><6E><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ٶ<EFBFBD><D9B6>ϴ<EFBFBD>.");
|
||||
}
|
||||
}else{
|
||||
//ajax Exception~!
|
||||
//console.log("response : "+response);
|
||||
if(errorfunc){
|
||||
eval(errorfunc);
|
||||
}else{
|
||||
alert("exception...");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
}
|
||||
},
|
||||
complete: function(){
|
||||
//alert("comment complete");
|
||||
},error:function(){
|
||||
alert("Web Service Error.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function ajaxCallJson(url, obj, target, method, func, exceptionfunc, errorfunc){
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: method,
|
||||
//dataType : "json",
|
||||
data: obj,
|
||||
success: function(response, textStatus, jqXHR){
|
||||
//alert("textStatus: "+textStatus+"\n jqXHR : "+jqXHR+"\n response : "+response);
|
||||
if(target){
|
||||
$(target).html(function (index, html){
|
||||
if(response == ""){
|
||||
$(location).attr('href', homeURL);
|
||||
return "";
|
||||
}
|
||||
return html = response;
|
||||
});
|
||||
}else{
|
||||
//console.log("target If Scope : "+response);
|
||||
}
|
||||
|
||||
//alert("Result Call back Function >> func : "+func);
|
||||
if(func){
|
||||
//alert("func If Scope >> target : "+target);
|
||||
//console.log("func If Scope >> target : "+target);
|
||||
if(target){
|
||||
eval(func);
|
||||
}else{
|
||||
if(typeof response == "object"){
|
||||
//alert("func If Scope [object] : "+response);
|
||||
//console.log("func If Scope [object] : "+response);
|
||||
ajaxResponse = response;
|
||||
eval(func);
|
||||
}else if(typeof response == "string"){
|
||||
if(response == "success"){
|
||||
//ajax Call Success~!
|
||||
//console.log("response : "+response);
|
||||
eval(func);
|
||||
}else if(response.length > 0){
|
||||
//alert("response : " + response);
|
||||
ajaxResponse = response;
|
||||
eval(func);
|
||||
}else{
|
||||
//ajax Exception~!
|
||||
//console.log("response : "+response);
|
||||
if(errorfunc){
|
||||
eval(errorfunc);
|
||||
}else{
|
||||
alert("exception...");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
}
|
||||
},
|
||||
complete: function(){
|
||||
//alert("comment complete");
|
||||
},error:function(){
|
||||
alert("Web Service Error.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function ajaxCall_nonError(url, obj, target, method, func, exceptionfunc, errorfunc){
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: method,
|
||||
data: obj,
|
||||
success: function(response, textStatus, jqXHR){
|
||||
//alert("textStatus: "+textStatus+"\n jqXHR : "+jqXHR+"\n response : "+response);
|
||||
if(target){
|
||||
$(target).html(function (index, html){
|
||||
if(response == ""){
|
||||
$(location).attr('href', homeURL);
|
||||
return "";
|
||||
}
|
||||
return html = response;
|
||||
});
|
||||
}else{
|
||||
//console.log("target If Scope : "+response);
|
||||
}
|
||||
|
||||
if(func){
|
||||
if(target){
|
||||
eval(func);
|
||||
}else{
|
||||
if(typeof response == "object"){
|
||||
//console.log("func If Scope [object] : "+response);
|
||||
ajaxResponse = response;
|
||||
eval(func);
|
||||
}else if(typeof response == "string"){
|
||||
if(response == "success"){
|
||||
//ajax Call Success~!
|
||||
//console.log("response : "+response);
|
||||
eval(func);
|
||||
}else if(response == "1"){
|
||||
//ajax Call Success~!
|
||||
//console.log("response : "+response);
|
||||
eval(func);
|
||||
}else if(response == "0"){
|
||||
//ajax Exception~!
|
||||
//console.log("response : "+response);
|
||||
if(errorfunc){
|
||||
eval(errorfunc);
|
||||
}else{
|
||||
alert("exception...");
|
||||
}
|
||||
}else if(response == "2"){
|
||||
//ajax Exception~!
|
||||
//console.log("response : "+response);
|
||||
if(exceptionfunc){
|
||||
eval(exceptionfunc);
|
||||
}else{
|
||||
alert("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><DFBB>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD>ϴ<EFBFBD>.\n<><6E><EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ٶ<EFBFBD><D9B6>ϴ<EFBFBD>.");
|
||||
}
|
||||
}else if(response.length > 0){
|
||||
//alert("response : " + response);
|
||||
ajaxResponse = response;
|
||||
eval(func);
|
||||
}else{
|
||||
//ajax Exception~!
|
||||
//console.log("response : "+response);
|
||||
if(errorfunc){
|
||||
eval(errorfunc);
|
||||
}else{
|
||||
alert("exception...");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
}
|
||||
},
|
||||
complete: function(){
|
||||
//alert("comment complete");
|
||||
},error:function(){
|
||||
//alert("Web Service Error.");
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user