Home > Jquery Ajax > Jquery Ajax Post 201 Error

Jquery Ajax Post 201 Error

What is the probability that they were born on different days? guest Response titleThis is preview!Attachments Publish Back to edit Cancel ()Sign In New to this Portal? You can fix it in jquery via the ajaxSetup method with the following code: $.ajaxSetup({dataFilter: function(data, type) { if (type == "json" && data == "") { data = null; } This might tell you why it's failing. –tbreffni Feb 11 '10 at 0:13 Could you please advice me where to look into i am new to consuming ADO.Net in have a peek here

Thank you. ckaiman commented Dec 4, 2013 Any resolution to this bug in tastypie? How do you handle these better i.e. 200, 201 within the success function? $.ajax({ type: "POST", dataType: "json", url: "http://api.domain.com/sms", data: { // Send value in mobile input field. Just FYI.

What does the pill-shaped 'X' mean in electrical schematics? My solution is to check error for 201 and pass to another callback, but I'd prefer not to have to hack it like this. Assuming that with the text converter, jQuery doesn't have trouble parsing an empty response body. jquery share|improve this question edited Feb 24 '13 at 14:09 asked Feb 24 '13 at 5:19 JayPrime2012 97731028 1 PS: to format code, just select it and hit the "code"

http://jsfiddle.net/JC9hZ/ demonstrates this issue using the jquery parseJSON() method. Ado.Net Entity Framework Sql ASP ASP.MVC CSS BootStrap Javascript General C# Automapper Unity Test Visual Studio WebServices WebApi WCF OData Home » ASP » ASP.MVC » Returning a JsonResult within the An alternative is to explicitly call out the statusCode: $.ajax({ statusCode: { 201: function() { console.log("HERE"); } } }); share|improve this answer answered Feb 20 '13 at 20:00 Keith Rousseau 3,46311224 It would seem that having an empty response return None instead of an empty string would solve the issue and maintain backwards compatibility with older versions of jQuery.

Resource address was given in a location response header. HTH. more hot questions question feed default about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation How to create a backslash fraction?

I had the same problem and one thing that solved it for me was leaving the "dataType" unsetted. I have also posted this issue for backbone-tastypie here: PaulUithol/backbone-tastypie#27 (comment) nick-allen commented Aug 9, 2013 It appears that jQuery.parseJSON and JSON.parse both handle null instead an empty string correctly, which How exactly std::string_view is faster than const std::string&? more hot questions question feed default about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation

On December 4, 2013 at 6:26:35 PM, ckaiman ***@***.***) wrote: Thank you, before your response, another said to simply change dataType: ‘jsonp’ to dataType: ‘text’ – which I did, and it Mind sending a slightly more detailed explanation? Name spelling on publications Red balls and Rings How does a Spatial Reference System like WGS84 have an elipsoid and a geoid? Send Update CancelFeedbackEmail IDSubject : Comments : Send CancelPrivate MessageType the characters you see in the picture below.

What to do when you've put your co-worker on spot by being impatient? http://softacoustik.com/jquery-ajax/jquery-error-ajax-post.php Not the answer you're looking for? In it, you'll get: The week's top questions and answers Important community announcements Questions that need answers see an example newsletter By subscribing, you agree to the privacy policy and terms Get the weekly newsletter!

When you do this jQuery will try to guess the data type the server is returning and will not throw an error when your server returns a 201 with no content. more hot questions question feed default about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation Since you are using Ajax you may not want to redirect your user to another page but just to display an alert that the operation is unsuccessful. Check This Out Equation which has to be solved with logarithms Is it possible to keep publishing under my professional (maiden) name, different from my married legal name?

more hot questions question feed default about us tour help blog chat data legal privacy policy work here advertising info mobile contact us feedback Technology Life / Arts Culture / Recreation This can be done by changing the Response Header with a Http Code that is different from the normal 200. How do I make a second minecraft account for my son?

How does a Spatial Reference System like WGS84 have an elipsoid and a geoid?

The 'text' option is only required for POST. Using the System.Web.Cache object into your MVC3 project » Leave a Reply Cancel reply Your email address will not be published. Now the real trick is to pass in a custom function for a success and not have to do the xhr.readystate check in every function. –Chris Jul 25 '12 at 21:34 Powered by WordPress | Compass by InkThemes.

share|improve this answer answered Feb 24 '13 at 15:15 JayPrime2012 97731028 2 I'm facing the same Issue, But event.preventDefault() doesn't solve my Issue. –Srikanth Jeeva Apr 16 '13 at 10:07 Copy codeClosePermalinkClosePlease tell us why you want to mark the subject as inappropriate. (Maximum 200 characters)Report Inappropriate CancelPrivate Message From : guestTo : Subject : Content : Type the characters you What happens if one brings more than 10,000 USD with them into the US? http://softacoustik.com/jquery-ajax/jquery-ajax-post-200-error.php When does bugfixing become overkill, if ever?

I may return json object depending on few corner cases so had to use datatype:"json" attribute. Compute the Eulerian number What do you call "intellectual" jobs? What does a profile's Decay Rate actually do? Is it better form to just return a 200 manually then? –justNeph Feb 20 '13 at 20:01 1 Does it work if you change it to 200? –Keith Rousseau Feb

Required fields are marked *Comment Name * Email * Website Search Categories Ado.Net Dapper.Net Entity Framework Linq To Sql ASP ASP.MVC ASP.Net Identity Telerik Asp.Net MVC VNext Best Practices UI C# I wonder why this is. –sshirley Jun 12 '14 at 0:27 5 If you look at the source github.com/jquery/jquery/blob/master/src/ajax.js#L706 - jquery is checking to see if the status is first What to do with my out of control pre teen daughter Sci-fi/Drama/Mystery movie with mini-stories and paintings that affect humans LED on the collector without a base limiting resistor Can you LED on the collector without a base limiting resistor How to remove this space in proof environment?

You can fix it in jquery via the ajaxSetup method with the following code: $.ajaxSetup({dataFilter: function(data, type) { if (type == "json" && data == "") { data = null; } Django, and tastypie, correctly returns an empty body content, jQuery just doesn't pass an intuitive response to the success callback. From: Sam Kuehn ***@***.*** Sent: Wednesday, December 04, 2013 6:50 PM To: toastdriven/django-tastypie Cc: ckaiman Subject: Re: [django-tastypie] Empty response in POST, PATCH and DELETE requests throws (json) parse error in Hot Network Questions The Framework of a Riddle Do I assume highly or strongly?

more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed I'm guessing it's a json parse error or a jQuery bug, but how can I confirm? My problem was not including a '.json' extension at the end of my query string, so I was getting XML back. Older versions of jQuery handled null, undefined, and '', returning null for all three.

nick-allen commented Aug 11, 2013 After some digging, this looks to be an issue with how jQuery's ajax function returns responses, not with tastypie. Would not allowing my vehicle to downshift uphill be fuel efficient?