Advertisement
Guest User

Untitled

a guest
Jan 11th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. var call = $.ajax({
  2. url: 'http://url:port/DynamicsNAV70_Instance/odata/MyService',
  3. type: "GET",
  4. crossDomain: true,
  5. username: "username",
  6. password: "password",
  7. dataType: "jsonp",
  8. headers: {
  9. Accept: "application/json;odata=verbose"
  10. }
  11. });
  12.  
  13. call.done(function (data, textStatus, jqXHR) {
  14. console.log(data.d);
  15. });
  16.  
  17. call.fail(function (jqXHR, textStatus, errorThrown) {
  18. console.log("Call failed. Error: " + jqXHR.statusText);
  19. });
  20.  
  21. jQuery.support.cors = true;
  22. var call = $.ajax({
  23. url: 'http://url:port/DynamicsNAV70_Instance/odata/MyService?$format=json',
  24. type: "GET",
  25. username: "username",
  26. password: "password",
  27. dataType: "json",
  28. headers: {
  29. Accept: "application/json;odata=verbose"
  30. }
  31. });
  32.  
  33. $.ajax({
  34. url: 'http://Server:Port/DynamicsNAV80/OData/Service?$format=json&$callback=?',
  35. contentType: 'application/json; charset=utf-8',
  36. dataType: "jsonp",
  37. type: "GET",
  38. xhrFields: {
  39. withCredentials: true
  40. },
  41. dataType: "jsonp",
  42. success: function (data) {
  43. alert(JSON.stringify(data));
  44. },
  45. error: function (xhr, textStatus, errorMessage) {
  46. alert('Error: ' + errorMessage);
  47. }
  48. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement