I am new to JavaScript and Ajax.
I have a form which posts to remote url and returns a XML response containing some data and a URL. I need to extract the url and redirec
Yes, due to the same origin policy restriction you cannot use javascript to perform this request. You could write a server side script that will perform the request to fetch the remote resource and then use an AJAX request to this server side script on your domain that will bring the XML and allow you to parse it.
Obviously depending on the server side language you are using there might be different ways to implement this.
But if you want to use jQuery it is pretty easy once you have setup this server side script on your domain. You simply use the $.ajax() method:
$.ajax({
url: '/url_to_your_server_side_script_that_serves_as_a_bridge',
success: function(xml) {
alert($('Result', xml).text());
}
});
And here's a live demo.