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 8233019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:59:51+00:00 2026-06-07T17:59:51+00:00

In the good case my JSON endpoint will return a proper JSON response: {status:

  • 0

In the good case my JSON endpoint will return a proper JSON response: {status: "success"}. However if my webserver 500 errors the 500 response body is HTML, which results in a SyntaxError if jQuery tries to parse it with $.parseJSON.

This question suggests just removing the dataType param from the request. I would rather not do that, is there a way to try/catch the SyntaxError thats raised by a non-JSON response?

  • 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-07T17:59:52+00:00Added an answer on June 7, 2026 at 5:59 pm

    From jQuery API

    Important: As of jQuery 1.4, if the JSON file contains a syntax error, 
    the request will usually fail silently.
    

    You can handle it the error callback.

    $.ajax({
            url: "MYURL",
            dataType: 'json',
            success: function(data) {
    
            },
            error: function(e) {
              if(e.status == 500)
                alert("500 Internal Server Error");
            }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Does anyone have a good Proper Case algorithm I am currently in
What is good design in this simple case: Let's say I have a base
somebody mentioned that the function (in this case a method) below is no good
I have a string: hello good old world and i want to upper case
OK, so the @Ignore annotation is good for marking that a test case shouldn't
It looks like good JSON objects typically have a name-value pair, with value being
On input I have a plain text (in my case typically it will be
After click a link, will trigger ajax require to /material/materialPrintajax , which will return
Good morning, I have mysql queries where I would like to calculate percentage of
Good day. I need to teach Windows CryptoAPI to encrypt the message with private

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.