0

From my JavaScript application I need to request some url that have two redirects(302) during the invocation.

This url works perfectly in the browser address bar but doesn't work via JavaScript $.get method. I know that there are problems with handling 302 redirect via JavaScript and GET.

Is any other ways in JavaScript to correctly handle this url with redirects ?

UPDATED

The following code:

$.ajax({
  type: "GET",
  url: 'https://example.com',
  complete: function(xhr) {
    console.log(xhr.getAllResponseHeaders());
  }
});

and

$.get( "https://example.com", function( data, textStatus, jqXHR ) {
  console.log(jqXHR.getAllResponseHeaders());
});

returns:

Content-Type: application/json
alexanoid
  • 24,051
  • 54
  • 210
  • 410

0 Answers0