Solved

How to read ajax returned data

Posted on 2014-02-23
5
437 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
  • 3
  • 2
5 Comments
 
LVL 52

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 52

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 52

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
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…

932 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now