Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8087257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:43:04+00:00 2026-06-05T18:43:04+00:00

My jQuery fu is new, so forgive the obvious if this question is indeed

  • 0

My jQuery fu is new, so forgive the obvious if this question is indeed that.

jQuery ajax documentation shows error and success defined as follows:

error(jqXHR, textStatus, errorThrown)
success(data, textStatus, jqXHR)

This is hosing me a bit consistency-wise as, by default, server-side I return status (200, 401, 404, etc.) along with a JSON encoded response, which could be a json error or success string, array, object and so on.

Basically what is happening is that on success receiving json string (coffeescript)

success: (data) ->
  $('#status').html( data )

I can print the json response string directly, which is confusing, as the equivalent error version requires me to parse the json string and access the responseText attrib of the data object:

error: (data) ->
  $('#status').html( jParse(data.responseText) )

So, how can I get client-side to mirror server-side consistency? i.e. respond with json server-side and know that I need parse/access object attrib(s) on client.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T18:43:06+00:00Added an answer on June 5, 2026 at 6:43 pm

    As I understand it, in “RESTful” services where success (or otherwise) is indicated in the HTTP status code, you’re not supposed to put meaningful content in the HTTP body of an error condition. Put it in the text of the 40x error code instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This link shows you that jQuery uses (new Function(return + data))(); for older browsers,
I'm new to jquery and asp.net so please forgive if this is an obvious
I'm new to js/jQuery. Forgive this horrible script. I'm lost. *(Updated with global variable
I have application that brings response via Ajax and creates 5-20 new jQuery click
I'm rather new to jQuery, so forgive me if this is trivial. I am
i'm new to jquery, so forgive me my misunderstandings. i use this code: $(.redbox).delegate(input[type=checkbox],
Please forgive me for any incorrect technical words used, I'm new to AJAX/Jquery. I
I am still pretty new to jQuery, so forgive me if this doesn't make
I'm new to programming so please forgive me if this is a dumb question...
The new jQuery v1.4 says this... jQuery.ajax() is now using onreadystatechange instead of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.