• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 503
  • Last Modified:

How to read ajax returned data

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
bujjigadu
Asked:
bujjigadu
  • 3
  • 2
1 Solution
 
Julian HansenCommented:
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
 
bujjigaduAuthor Commented:
I'm attaching the sample data file here
datafile-EE.txt
0
 
Julian HansenCommented:
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
 
bujjigaduAuthor Commented:
Good
0
 
Julian HansenCommented:
@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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now