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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:18:13+00:00 2026-05-21T14:18:13+00:00

The following JSON is what I am sending back to my jQuery script from

  • 0

The following JSON is what I am sending back to my jQuery script from the server.

{"items": [
{ "id": "116", "first_name": "Sean", "last_name": "borsen" },
{ "id": "871", "first_name": "Sergio", "last_name": "spake" },
{ "id": "1337", "first_name": "SethTest", "last_name": "Test" }
],
"message": "success"
}

I intend to use this object to build an html table. When I return this type of JSON though, I get either of the following 2 errors in Chrome:

Uncaught SyntaxError: Unexpected token ‘,’

or this error

Uncaught SyntaxError: Unexpected token ‘:’

Here is my AJAX post code

            $.ajax({
                url: "ClientEmarGroup.aspx",
                datatype: 'json',
                data: eval('(' + d + ')'),
                success: bindData
            });

Here is the line I get the error on in my bindData function:

    bindData = function (data) {
        var $d = eval("(" + data + ")");

Further, I get the script to work if I format my JSON items like so:

{"items": [
{ "id": "116", "name": "Sean borsen" },
{ "id": "871", "name": "Sergio spake" },
],
"message": "success"
}

But thats not what I want.

So my question is, what is wrong with my JSON string formatting that is preventing me from sending a complex object back to jQuery?

How do I format my JSON to return an array of items that have more than 2 properties?

  • 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-21T14:18:13+00:00Added an answer on May 21, 2026 at 2:18 pm

    You have spelled the proeprty dataType wrong, note the capital T.

    This causes jQuery to try to find out by itself what the data type is, and if you don’t serve the JSON with the correct content type, it will try to parse it as something else, like XML.

    If jQuery manages to guess the data type correctly, it will parse the string to an object before calling the success function, so you should not parse the data again.

    Note: If you need to parse JSON, you should note the eval function, you should use the $.parseJSON method.

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

Sidebar

Related Questions

On my client side I'm sending an ajax request with jQuery in the following
i have the following code on my aspx page: jQuery(#listFondos).jqGrid({ url: '/PorMyController/LoadGridData/', datatype: 'json',
say I have the following json object; {'fname':'john', 'lname':'Locke'} and the following text boxes
I basically have the following flow: XML -> JSON -> Spring MVC -> jsp
I'm attempting to use the following code to serialize an anonymous type to JSON:
I have the following javascript: $.ajax({ type: "POST", dataType: "json", url: "/Home/Submit", data: {
Trying to create a list to return some JSON data to a view. Following
Following on from my recent question on Large, Complex Objects as a Web Service
Following on from this question what would be the best way to write a
I have the following JSON: { @id: hey there, id: hey there 2 }

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.