'Send XML with JQuery to port device inside my local network

I would like to introduce my problem, I have two different computers in the same local network.

One running the Javascript code.

And the other is a Windows computer with a device connected to the port 5254.

I would like to send XML's from the first computer to the second device that it's allocated in the port 5254 of the second computer, using Javascript.

My actual proposal it's the following:

function exampleFunction() {
var xmlDocument =
    '<?xml version="1.0" encoding="UTF-8"?>' +
    '<version>1.0</version>';

$.ajax({
    url: 'http://192.168.1.17:5254',
    type: 'POST',
    crossDomain: true,
    data: {
        data: xmlDocument
    },
    dataType: 'text/xml',
    success: function (data) {
        console.log(data);
        alert('result');
    },
    error: function (jqXHR, tranStatus, errorThrown) {
   
        alert(

            'Status: ' + jqXHR.status + ' ' + jqXHR.statusText + '. ' +
            'Response: ' + jqXHR.responseText
        );
    }
    });
}

The XML's is just an example.

I'm not currently able to do that I'm always getting the error function.

I saw that I'm probably not able to connect to other port due to the same origin policy But I don't know if it's specific to my problem or not, or if there are other alternatives to correct that.

Thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source