Skip to content

Instantly share code, notes, and snippets.

@vgrem
Created February 5, 2016 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgrem/9bb29f364f7f2583ff63 to your computer and use it in GitHub Desktop.
Save vgrem/9bb29f364f7f2583ff63 to your computer and use it in GitHub Desktop.
function executeJson(url,method,headers,payload)
{
headers = headers || {};
method = method || 'GET';
headers["Accept"] = "application/json;odata=verbose";
var ajaxOptions =
{
url: url,
type: method,
contentType: "application/json;odata=verbose",
headers: headers
};
if(payload) {
ajaxOptions.data = JSON.stringify(payload);
}
return $.ajax(ajaxOptions);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment