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

  • Home
  • SEARCH
  • 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 6856757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:55:35+00:00 2026-05-27T01:55:35+00:00

This is my code, function responseLogin(response) { var newArray = jQuery.parseJSON(response); alert(newArray.AccountEmail); } This

  • 0

This is my code,

function responseLogin(response)
{
var newArray = jQuery.parseJSON(response);
alert(newArray.AccountEmail);
}

This is what is alerted,

{"AccountEmail":["Alphabets and numbers only","Alphabets and numbers only"]}

It has not been converted back to an array and i don’t know why. I get the same result if i just use

alert(newArray);

Thanks

EDIT ___

This is what i get after console.log

AccountEmail
["Alphabets and numbers only", "Alphabets and numbers only"]    
0
"Alphabets and numbers only"

1
"Alphabets and numbers only"

EDIT 2 ___

if i use alert on the original response i get

[object Object]

Now i’m no expert at JavaScript but i don’t think that is json.
This was the PHP used to generate it (which i have used before and it has worked)

echo json_encode($this->Account->invalidFields());
  • 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-27T01:55:35+00:00Added an answer on May 27, 2026 at 1:55 am

    Edited to match new question text

    If I run this statement in Firebug it works as expected:

    alert(jQuery.parseJSON('{"AccountEmail":["Alphabets and numbers only","Alphabets and numbers only"]}').AccountEmail)
    

    What it alerts:

    Alphabets and numbers only,Alphabets and numbers only

    So I’d say there’s something dodgy with your response argument. When you alert the response argument directly it claims to be an Object, but parseJSON requires a well-formed JSON string.

    Try grabbing the Firebug FF addon if you don’t have it already. Hit F12 to bring it up, activate the console panel, place a debugger; statement at the top of your function, and refresh the page. In the Firebug panel right next to the console is a “Watch” you can use to investigate what’s inside the response variable by hovering/clicking on it.

    Another thing to check: isn’t the PHP script echo-ing anything else before/after the mentioned echo statement?

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

Sidebar

Related Questions

View this code: function testprecision(){ var isNotNumber = parseFloat('1.3').toPrecision(6); alert(typeof isNotNumber); //=> string }
I have this code function getSelectData(id) { jQuery(id).change(function () { var value=''; jQuery(id+ option:selected).each(function
This code function LoadContent(Id) { alert('Controls/Network/NetworkDetail.aspx?' + rnd() + '&CtlId=' + Id); $.get('Controls/Network/NetworkDetail.aspx?' +
Hello I get a weird error in this code: function validateForm(aform) { var s=;
i have this code $(function() { $('#ans_vote a span').click(function(){alert('working');return false;});}); and this html <div
I have this piece of code: function func1(text) { var pattern = /([\s\S]*?)(\<\?(?:attrib |if
With this code: function setupRow(event, ui) { var textbox, // how do i get
This code: function foo(){ var x = 5; var y = 8.8; var exp1
I had this code : function (i) { alert(i); }(3); And it wasn't working
i have seen this code: Function.prototype.bind = function (bind) { var self = this;

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.