I have created an Addin using JavaScript for Microsoft Dynamics Nav 2013, it works fine when I am using it in the same machine where Navision is. Nevertheless,when I replace “localhost” for the name of the machine, it does not work. This is my script:
$(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 suggestion?
Thank you very much.