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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:06:46+00:00 2026-05-10T23:06:46+00:00

I have a problem. I built a script to make a request to an

  • 0

I have a problem. I built a script to make a request to an internal link that sends back a response. This is what the script looks like:

jQuery.get(callUrl, function(data) {   console.log(typeof data);   jQuery.each(data.items, function(i, item) {      console.log(i);   }); }, 'json'); 

and the response that the server sends back looks like this:

{'items':[               {    'src': 'gallery_item_data_Jc4EaLP6vlwd_large.jpg',    'id': '83',    'gallery_id': '30',    'username': 'admin'   }] } 

My problem is when I parse the ‘data’ its type is always string. I need for it to be an object so that I can query it and parse it with my script. To get to the bottom of the problem, I’ve tried comparing my script to the example on jQuery’s documentation page:

http://docs.jquery.com/Ajax/jQuery.getJSON

The main differences with the request on this page and my request is that it uses the getJSON method. When I tried to use that with the url to my server, I have gotten no response at all, so that is the main reason I opted for the get method, and specifying the return type as ‘json.’

Another thing I tried: I checked out the Flickr feed that the jQuery example uses to look for the Content-type header that it sends back, thinking maybe my feed had the wrong header, and it is this on the Flickr feed:

Content-Type    application/x-javascript; charset=utf-8 

This is exactly the same header on my own feed. So I am puzzled. Does anyone know why this is happening?

  • 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. 2026-05-10T23:06:47+00:00Added an answer on May 10, 2026 at 11:06 pm

    The JSON needs to have brackets around it, so it should be:

    ({'items':[               {    'src': 'gallery_item_data_Jc4EaLP6vlwd_large.jpg',    'id': '83',    'gallery_id': '30',    'username': 'admin'   }] }) 

    You should then be able to use getJSON, as this is the easiest way to get the data as an object. However, you can also eval() the string and that will return an object.

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

Sidebar

Related Questions

I have this fragment that demonstrates the problem: <html> <head> <title>height query demo</title> <script
i have bought a template that have built in contact form problem is that
I have been unable to figure out this problem - it just doesn't make
I have a command-line application written in C++ and built with gcc/make that runs
I am trying to make my table be sortable. I have found this script
I have seen this problem arise in many different circumstances and would like to
The problem: I have a jQuery heavy page that has a built in admin
I have a problem with a CURL request i make in php. The issue
I have following problem: I have built a tabbar application with 4 tabs. I
My setup: Ubuntu LAMP, application built w/ zend framework My Problem: I have a

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.