I have developed a JavaScript Addin for Microsoft Dynamics Nav 2013. The Addin functions properly when used on the same machine as Navision. However, when I replace "localhost" with the machine's name, the Addin stops working. Below is the script I am using:
$(document).ready(function() {
//This does not work
var url = "http://myService:7057/OData/Company('Company')/CRMSPABookings?$format=json";
// This works
// var url = "http://localhost:7057/OData/Company('Company')/CRMSPABookings?$format=json";
$.ajaxSetup({
xhrFields: {
withCredentials: true
}
});
var http_request = new XMLHttpRequest();
http_request.open("GET", url, false);
http_request.withCredentials = "true";
http_request.send();
xmlDocImage = http_request.responseText;
var x = JSON.parse(xmlDocImage);
});
Any advice on how to resolve this issue would be greatly appreciated.
Thank you.