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("callURL = " + callURL);
 | 
				
			||||||
                this.trace("responseDataType = " + responseDataType);
 | 
					                this.trace("responseDataType = " + responseDataType);
 | 
				
			||||||
 | 
					                var ajaxRequest = null;
 | 
				
			||||||
                if (method == "GET") {
 | 
					                if (method == "GET") {
 | 
				
			||||||
                    $.get(callURL, postObject,
 | 
					                    // $.get(callURL, postObject,
 | 
				
			||||||
                            function(response) {
 | 
					                    //         function(response) {
 | 
				
			||||||
                                ApiInvoker.fire(completionEvent, returnType, requestId, response, callback);
 | 
					                    //             ApiInvoker.fire(completionEvent, returnType, requestId, response, callback);
 | 
				
			||||||
                            }, responseDataType).complete(this.showCompleteStatus).error(this.showErrorStatus);
 | 
					                    //         }, responseDataType).complete(this.showCompleteStatus).error(this.showErrorStatus);
 | 
				
			||||||
//                    $.ajax({
 | 
					                   ajaxRequest =  $.ajax({
 | 
				
			||||||
//                        url: callURL,
 | 
					                       url: callURL,
 | 
				
			||||||
//                        data: JSON.stringify(postObject),
 | 
					                       data: JSON.stringify(postObject),
 | 
				
			||||||
//                        type: "GET",
 | 
					                       type: "GET",
 | 
				
			||||||
//                        dataType: "json",
 | 
					                       dataType: "jsonp",
 | 
				
			||||||
//                        contentType: "application/json",
 | 
					                       contentType: "application/json",
 | 
				
			||||||
//                        success: function(response) {
 | 
					                       success: function(response) {
 | 
				
			||||||
//                            ApiInvoker.fire(completionEvent, returnType, requestId, response, callback);
 | 
					                           ApiInvoker.fire(completionEvent, returnType, requestId, response, callback);
 | 
				
			||||||
//                        }
 | 
					                       }
 | 
				
			||||||
//                    }).complete(this.showCompleteStatus).error(this.showErrorStatus);
 | 
					                   }).complete(this.showCompleteStatus).error(this.showErrorStatus);
 | 
				
			||||||
                } else if (method == "POST") {
 | 
					                } else if (method == "POST") {
 | 
				
			||||||
                    this.trace("sending post");
 | 
					                    this.trace("sending post");
 | 
				
			||||||
                    this.trace(JSON.stringify(postObject));
 | 
					                    this.trace(JSON.stringify(postObject));
 | 
				
			||||||
                    $.ajax({
 | 
					                    ajaxRequest =  $.ajax({
 | 
				
			||||||
                        url: callURL,
 | 
					                        url: callURL,
 | 
				
			||||||
                        data: JSON.stringify(postObject),
 | 
					                        data: JSON.stringify(postObject),
 | 
				
			||||||
                        type: "POST",
 | 
					                        type: "POST",
 | 
				
			||||||
@ -102,7 +102,7 @@ var ApiInvoker = new function() {
 | 
				
			|||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }).complete(this.showCompleteStatus).error(this.showErrorStatus);
 | 
					                    }).complete(this.showCompleteStatus).error(this.showErrorStatus);
 | 
				
			||||||
                } else if (method == "PUT") {
 | 
					                } else if (method == "PUT") {
 | 
				
			||||||
                    $.ajax({
 | 
					                    ajaxRequest = $.ajax({
 | 
				
			||||||
                        url: callURL,
 | 
					                        url: callURL,
 | 
				
			||||||
                        data: JSON.stringify(postObject),
 | 
					                        data: JSON.stringify(postObject),
 | 
				
			||||||
                        type: "PUT",
 | 
					                        type: "PUT",
 | 
				
			||||||
@ -113,7 +113,7 @@ var ApiInvoker = new function() {
 | 
				
			|||||||
                        }
 | 
					                        }
 | 
				
			||||||
                    }).complete(this.showCompleteStatus).error(this.showErrorStatus);
 | 
					                    }).complete(this.showCompleteStatus).error(this.showErrorStatus);
 | 
				
			||||||
                } else if (method == "DELETE") {
 | 
					                } else if (method == "DELETE") {
 | 
				
			||||||
                    $.ajax({
 | 
					                    ajaxRequest = $.ajax({
 | 
				
			||||||
                        url: callURL,
 | 
					                        url: callURL,
 | 
				
			||||||
                        data: JSON.stringify(postObject),
 | 
					                        data: JSON.stringify(postObject),
 | 
				
			||||||
                        type: "DELETE",
 | 
					                        type: "DELETE",
 | 
				
			||||||
@ -125,7 +125,7 @@ var ApiInvoker = new function() {
 | 
				
			|||||||
                    }).complete(this.showCompleteStatus).error(this.showErrorStatus);
 | 
					                    }).complete(this.showCompleteStatus).error(this.showErrorStatus);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return ajaxRequest;
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            this.guid = function() {
 | 
					            this.guid = function() {
 | 
				
			||||||
 | 
				
			|||||||
@ -76,26 +76,26 @@ $endif$
 | 
				
			|||||||
$if(!method.responseVoid)$
 | 
					$if(!method.responseVoid)$
 | 
				
			||||||
            returnType = $method.returnClassName$;
 | 
					            returnType = $method.returnClassName$;
 | 
				
			||||||
$endif$
 | 
					$endif$
 | 
				
			||||||
 | 
					            var ajaxRequest = null;
 | 
				
			||||||
$if(method.postObject)$
 | 
					$if(method.postObject)$
 | 
				
			||||||
$if(method.authToken)$
 | 
					$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$
 | 
					$endif$
 | 
				
			||||||
$if(!method.authToken)$
 | 
					$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$
 | 
				
			||||||
$endif$
 | 
					$endif$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$if(!method.postObject)$
 | 
					$if(!method.postObject)$
 | 
				
			||||||
$if(method.authToken)$
 | 
					$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$
 | 
					$endif$
 | 
				
			||||||
$if(!method.authToken)$
 | 
					$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$
 | 
				
			||||||
$endif$
 | 
					$endif$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return requestId;
 | 
					            return {"requestId":requestId, "ajaxRequest":ajaxRequest};
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
}$
 | 
					}$
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user