201 is considered as a success. It could be an error somewhere else, try to step through httpSuccess function.
// Determines if an XMLHttpRequest was successful or not httpSuccess: function( xhr ) { try { // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 return !xhr.status && location.protocol == "file:" || ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223; } catch(e){} return false; } On Jul 21, 2:42 pm, Nitin <nitins.shu...@gmail.com> wrote: > Hello, > > I am using jquery.ajax() to make a POST call to web server which > returns HTTP 201 response for successful creation of object at server. > Since 201 is a success I expect the success function specified with > jquery.ajax to execute but instead it executes the error function > specified with jquery.ajax. Here is how I am using jquery.ajax call. > > request = '<user><name>SomeName</name></user>'; > $.ajax({ > error:function(request) { > alert('Error creating user'); > }, > success:function(xml, textStatus) { > alert('success'); > }, > type: 'POST', > contentType: 'application/xml;charset=UTF-8', > url: server_root + '/management/users/', > data: request > > }); > > Does success function gets executed only for HTTP 200 Response or will > it be executed for HTTP 201 Response too? > > In case success function gets executed only for 200 response, how can > I handle 201 response which is a success response? > > Any help to resolve above issue is appreciated. > > Thanks, > Regards, > Nitin