Skip to main content
corrected typo
Source Link
Till
  • 22.4k
  • 4
  • 61
  • 89

Use the low-level $.ajax() call:

$.ajax({ url: "/yourservlet", data: { }, complete: function(xmlHttp) { // xmlHttp is a XMLHttpRquest object alert(xmlHttp.codestatus); } }); 

Try this for a redirect:

if (xmlHttp.code != 200) { top.location.href = '/some/other/page'; } 

Use the low-level $.ajax() call:

$.ajax({ url: "/yourservlet", data: { }, complete: function(xmlHttp) { // xmlHttp is a XMLHttpRquest object alert(xmlHttp.code); } }); 

Try this for a redirect:

if (xmlHttp.code != 200) { top.location.href = '/some/other/page'; } 

Use the low-level $.ajax() call:

$.ajax({ url: "/yourservlet", data: { }, complete: function(xmlHttp) { // xmlHttp is a XMLHttpRquest object alert(xmlHttp.status); } }); 

Try this for a redirect:

if (xmlHttp.code != 200) { top.location.href = '/some/other/page'; } 
Extended answer
Source Link
Till
  • 22.4k
  • 4
  • 61
  • 89

Use the low-level $.ajax() call:

$.ajax({ url: "/yourservlet", data: { }, complete: function(xmlHttp) { // xmlHttp is a XMLHttpRquest object alert(xmlHttp.code); } }); 

Try this for a redirect:

if (xmlHttp.code != 200) { top.location.href = '/some/other/page'; } 

Use the low-level $.ajax() call:

$.ajax({ url: "/yourservlet", data: { }, complete: function(xmlHttp) { // xmlHttp is a XMLHttpRquest object alert(xmlHttp.code); } }); 

Use the low-level $.ajax() call:

$.ajax({ url: "/yourservlet", data: { }, complete: function(xmlHttp) { // xmlHttp is a XMLHttpRquest object alert(xmlHttp.code); } }); 

Try this for a redirect:

if (xmlHttp.code != 200) { top.location.href = '/some/other/page'; } 
Source Link
Till
  • 22.4k
  • 4
  • 61
  • 89

Use the low-level $.ajax() call:

$.ajax({ url: "/yourservlet", data: { }, complete: function(xmlHttp) { // xmlHttp is a XMLHttpRquest object alert(xmlHttp.code); } });