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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:08:57+00:00 2026-05-27T16:08:57+00:00

Wasn’t sure how to phrase the title but here is my problem: Here is

  • 0

Wasn’t sure how to phrase the title but here is my problem:

Here is my javascript:

$.post("register", element.serialize(),
        function(data){
             if(data.success == "true"){
                           // Do whatever
            } else if (data.success == "false"){

                for (i = 0; i < data.errors.length; i++){
                      // This is what I need to change      
                      alert(data.errors[i][0]);
                }
            }
        }, "json");

Here is the incoming JSON string:

{"success":"false","errors":{"username":"error with username","email":"error with email"}}

Broken up, that is:

errors: {
   email: "error with email"
   username: "error with username" }
success: "false"

I want the alerts to say “error with email” and “error with username”

Nothing I seem to be doing is working though, any ideas?

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-05-27T16:08:58+00:00Added an answer on May 27, 2026 at 4:08 pm

    data.errors is not an array. It’s an object with properties:

    data.errors.username
    data.errors.email
    

    It’s unclear from your question what you want to do with those two properties, but that’s how you access them.

    If you want to iterate the properties of the errors object, you can do that like this:

    for (var key in data.errors) {
        // data in data.errors[key] here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wasn't sure what the title should be but its s simple concept but
I have a strange problem and I wasn't sure how to word the title.
I wasn't sure how to write topic correctly but lemme describe what problem I
I wasn't sure exactly how to phrase the question Title. I have this block
Hello I wasn't quite sure how to title this question, but I'll explain why
I wasn't sure how to phrase this so the title is a bit cryptic.
I wasn't sure of the title, but I hope you will be able to
I wasn't even sure how to phrase this so you'll have to forgive me
Sorry if the post title wasn't clear, I will try to explain a little
I wasn't sure what the best title is so if anyone has a better

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.