Solved

How to read ajax returned data

Posted on 2014-02-23
5
466 Views
Last Modified: 2014-02-25
I have ajax function that I'm called a stored procedure and returning data into an array, but when I loop through the array I'm getting undefined. But the data is getting retrieved when debugging the code. Below is attached file code, the array is a multidimenstional array but when I do for loop I should hit alert("Yes Admin") but the data is showing as an object. How to read the data and put my if condtions with in the for loop.
code-EE.txt
0
Comment
Question by:bujjigadu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 58

Expert Comment

by:Julian Hansen
ID: 39881765
Two questions

1. What format is your data being returned in from your script
2. Can you post a sample of the data being returned.
0
 

Author Comment

by:bujjigadu
ID: 39882565
I'm attaching the sample data file here
datafile-EE.txt
0
 
LVL 58

Accepted Solution

by:
Julian Hansen earned 370 total points
ID: 39882736
So you are retuning your data as JSon - but you don't tell your ajax call that is what you are doing.

Try adding

   dataType: 'JSON'

To your AJAX call parameters.
0
 

Author Comment

by:bujjigadu
ID: 39885861
Good
0
 
LVL 58

Expert Comment

by:Julian Hansen
ID: 39886079
@bujjigadu, is there any particular reason you awarded a B for this question?

Default is an A unless there is a specific reason for it to be a B.

You can read more about grading guidelines here http://support.experts-exchange.com/customer/portal/articles/481419
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question