3

In my page i'm doing an ajax rest call to an external

the url is formatted like this:

var url = "http://someurl.somedomain.com/WS/?SomeVariable=global&SomeCOde="+code.val();

The url is generated after a submit event of a form.

$(document).ready(function(){
    console.log('ready!');
    $('#form').submit(function(event){
        event.preventDefault();
        var code = $('#code');
        if ( code.val() !== '' ) {
            var url = "http://someurl.somedomain.com/WS/?SomeVariable=global&SomeCOde="+code.val();
            // Chiamata rest
            $.ajax({
                url: url,
                dataType:'xml',
                crossDomain: true,
                type: 'GET',
                success: function(data, status, response) {

                }
            });
        } else {
            code.css('outline', 'solid 1px red');
        }
    });
});

I'm expecting from this call a XML response but in the console log it appear the error:

XMLHttpRequest cannot load http://someurl.somedomain.com/WS/?SomeVariable=global&SomeCOde=xxxx. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.someurl.it' is therefore not allowed access.

How can i resolve it? How can i set ajax after for a xml response?

Thanks for all the help

giovaZ
  • 1,432
  • 3
  • 20
  • 62

0 Answers0