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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:21:07+00:00 2026-06-11T04:21:07+00:00

console.log(data) gives the following results { ERRORS: [ { MESSAGE: Error on API., CODE:

  • 0

console.log(data) gives the following results

{
    "ERRORS": [
        {
            "MESSAGE": "Error on API.",
            "CODE": "hermes05"
        }
    ],
    "DATA": {}
}

When I try to get the value message out I get undefined, why?

error: function(data){

  console.log(data.ERRORS[0].MESSAGE);

}

FULL CODE

 $.ajax({
                type: "POST",
                dataType: "json",
                url: "http://api.domain.com/something",
                data: {
                    // Send value in mobile input field.
                    mobile:  $("#mobileNo").val()
                },

                success: function(data){

                },

        error: function(data){

             console.log(data.ERRORS.MESSAGE);

                }
            });


            // stop button from submitting.
            event.preventDefault(); // cancel default behavior
        });
  • 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-11T04:21:09+00:00Added an answer on June 11, 2026 at 4:21 am

    What you want is

    error: function(jqXhr) {
      try {
        data = JSON.parse(jqXhr.responseText);
        console.log(data.ERRORS[0].MESSAGE);
      } catch (err) {
        console.log("Response was not valid JSON");
      }
    }
    

    Check out the difference between success and error at http://api.jquery.com/jQuery.ajax/

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

Sidebar

Related Questions

I have this code inside a iframe: window.addEventListener('message', function(e){ if(e.data == 'test') console.log(e); },
I'm using console.log(variable) and firebug to examine javascript code. Occasionally, I get [object][object] as
google.visualization.events.addListener( geomap, regionClick, function(e) { console.log(e[region]); console.log(data.getValue(e[region],1)); }); I use this code to see
I am using: $.post('fromDB.php', function(data) { eval(data); console.log(data); updateTimer(); }); to get some arrays
$.getJSON('http://twitter.com/followers/ids.json?screen_name=' + query1 + '&callback=?', function (data) { console.log('JSON data string 1 is: '
var list = []; $.getJSON(json.js, function(data) { $.each(data, function(i, item) { console.log(item.text); list.push(item.text); });
If I console log test I get [ { property_1: a, property_2: b, }
Given the following console output, why is my Core Data save failing? It seems
I have the following code var test; $.ajax({ type: "GET", url: "../views/person/controller.php?actor=person&action=checkAge", data: "age="
given the following: where data is a string received as an AJAX value and

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.