0

I need one help, I have a form after submitting the form, the action url return the an xml data to the browser, i want to get the xml data to a variable. unable to fetch, i tried following code

$( "#searchForm" ).submit(function( event ) {
$.ajax({
        type: "GET",
        url: "my_remote_url",
        dataType: "xml",
        success: xmlParser
    });

})
function xmlParser(xml) {
console.log(xml);
}

shows an error of access control CORS error on console, please guide me to retrieve the data

1 Answers1

0

try this:

//datatype:"xml",it is not needed
success: function(res){
alert(res);//this will alert the response if ajax is success.
}
user3064914
  • 921
  • 1
  • 7
  • 18