I m trying to access a data after invoking a URL which redirects the output to another page with query strings.
ie:
$.ajax({
url: 'http://foo.com/results/bar.aspx?fooid = 123&more=1',
success: function(data) {
alert('Load was performed.'+data);
}
});
Reponse results empty. This URL is a redirect to another page with query string, I already have a page that parses the query string and write the output to a page.
But response is blank.
How can i get this data?
By calling
getResponseHeader()on thexmlHttpRequest-object, you can get the value of"Location"and see if a redirect is occuring. In that case, you can use the value as the new URL.To improve the code, you should first look at the status code to see if a redirect is really happening. The status code should be 301 or 302.