forked from loafle/openapi-generator-original
Fixed IE issues and also returning ajax request object as part fo invoking the method
This commit is contained in:
parent
7339611575
commit
704bfd7cb1
@ -71,26 +71,26 @@ var ApiInvoker = new function() {
|
||||
|
||||
this.trace("callURL = " + callURL);
|
||||
this.trace("responseDataType = " + responseDataType);
|
||||
|
||||
var ajaxRequest = null;
|
||||
if (method == "GET") {
|
||||
$.get(callURL, postObject,
|
||||
function(response) {
|
||||
ApiInvoker.fire(completionEvent, returnType, requestId, response, callback);
|
||||
}, responseDataType).complete(this.showCompleteStatus).error(this.showErrorStatus);
|
||||
// $.ajax({
|
||||
// url: callURL,
|
||||
// data: JSON.stringify(postObject),
|
||||
// type: "GET",
|
||||
// dataType: "json",
|
||||
// contentType: "application/json",
|
||||
// success: function(response) {
|
||||
// ApiInvoker.fire(completionEvent, returnType, requestId, response, callback);
|
||||
// }
|
||||
// }).complete(this.showCompleteStatus).error(this.showErrorStatus);
|
||||
// $.get(callURL, postObject,
|
||||
// function(response) {
|
||||
// ApiInvoker.fire(completionEvent, returnType, requestId, response, callback);
|
||||
// }, responseDataType).complete(this.showCompleteStatus).error(this.showErrorStatus);
|
||||
ajaxRequest = $.ajax({
|
||||
url: callURL,
|
||||
data: JSON.stringify(postObject),
|
||||
type: "GET",
|
||||
dataType: "jsonp",
|
||||
contentType: "application/json",
|
||||
success: function(response) {
|
||||
ApiInvoker.fire(completionEvent, returnType, requestId, response, callback);
|
||||
}
|
||||
}).complete(this.showCompleteStatus).error(this.showErrorStatus);
|
||||
} else if (method == "POST") {
|
||||
this.trace("sending post");
|
||||
this.trace(JSON.stringify(postObject));
|
||||
$.ajax({
|
||||
ajaxRequest = $.ajax({
|
||||
url: callURL,
|
||||
data: JSON.stringify(postObject),
|
||||
type: "POST",
|
||||
@ -102,7 +102,7 @@ var ApiInvoker = new function() {
|
||||
}
|
||||
}).complete(this.showCompleteStatus).error(this.showErrorStatus);
|
||||
} else if (method == "PUT") {
|
||||
$.ajax({
|
||||
ajaxRequest = $.ajax({
|
||||
url: callURL,
|
||||
data: JSON.stringify(postObject),
|
||||
type: "PUT",
|
||||
@ -113,7 +113,7 @@ var ApiInvoker = new function() {
|
||||
}
|
||||
}).complete(this.showCompleteStatus).error(this.showErrorStatus);
|
||||
} else if (method == "DELETE") {
|
||||
$.ajax({
|
||||
ajaxRequest = $.ajax({
|
||||
url: callURL,
|
||||
data: JSON.stringify(postObject),
|
||||
type: "DELETE",
|
||||
@ -125,7 +125,7 @@ var ApiInvoker = new function() {
|
||||
}).complete(this.showCompleteStatus).error(this.showErrorStatus);
|
||||
}
|
||||
|
||||
|
||||
return ajaxRequest;
|
||||
},
|
||||
|
||||
this.guid = function() {
|
||||
|
@ -76,26 +76,26 @@ $endif$
|
||||
$if(!method.responseVoid)$
|
||||
returnType = $method.returnClassName$;
|
||||
$endif$
|
||||
|
||||
var ajaxRequest = null;
|
||||
$if(method.postObject)$
|
||||
$if(method.authToken)$
|
||||
ApiInvoker.invokeAPI(authToken, resourcePath, method, queryParams, postData, eventName, requestId, returnType, callback);
|
||||
ajaxRequest = ApiInvoker.invokeAPI(authToken, resourcePath, method, queryParams, postData, eventName, requestId, returnType, callback);
|
||||
$endif$
|
||||
$if(!method.authToken)$
|
||||
ApiInvoker.invokeAPI(null, resourcePath, method, queryParams, postData, eventName, requestId, returnType, callback);
|
||||
ajaxRequest = ApiInvoker.invokeAPI(null, resourcePath, method, queryParams, postData, eventName, requestId, returnType, callback);
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
$if(!method.postObject)$
|
||||
$if(method.authToken)$
|
||||
ApiInvoker.invokeAPI(authToken, resourcePath, method, queryParams, null, eventName, requestId, returnType, callback);
|
||||
ajaxRequest = ApiInvoker.invokeAPI(authToken, resourcePath, method, queryParams, null, eventName, requestId, returnType, callback);
|
||||
$endif$
|
||||
$if(!method.authToken)$
|
||||
ApiInvoker.invokeAPI(null, resourcePath, method, queryParams, null, eventName, requestId, returnType, callback);
|
||||
ajaxRequest = ApiInvoker.invokeAPI(null, resourcePath, method, queryParams, null, eventName, requestId, returnType, callback);
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
return requestId;
|
||||
return {"requestId":requestId, "ajaxRequest":ajaxRequest};
|
||||
}
|
||||
}$
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user