Created
June 18, 2015 10:58
-
-
Save gladiatorAsh/161e79fa5c1668fb0981 to your computer and use it in GitHub Desktop.
Ajax Call
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ajaxCall = { | |
getData: function (urlPart, callback) { | |
var xhr = $.ajax({ | |
url: siteurl + "/_vti_bin/ERIMS.SPWCFService/Rolta.DOI.ERIMS.SPWCFService.svc/" + urlPart, | |
type: "GET", | |
headers: { | |
"content-type": "application/json;odata=verbose", | |
"accept": "application/json;odata=verbose", | |
"X-RequestDigest": $("#__REQUESTDIGEST").val() | |
}, | |
tryCount: 0, | |
retryLimit: 3, | |
success: function (data) { | |
callback(data); | |
} | |
}); | |
return xhr; | |
}, | |
postData: function (urlPart, jsonData, callback) { | |
$.ajax({ | |
url: siteurl | |
+ "/_vti_bin/ERIMS.SPWCFService/Rolta.DOI.ERIMS.SPWCFService.svc/" + urlPart, | |
type: "POST", | |
data: jsonData, | |
headers: { | |
"content-type": "application/json;odata=verbose", | |
"accept": "application/json;odata=verbose", | |
"X-RequestDigest": $("#__REQUESTDIGEST").val() | |
}, | |
success: function (data) { | |
callback(data); | |
} | |
}); | |
} | |
}; | |
$.extend(ajaxCall); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment