Solved

How to read ajax returned data

Posted on 2014-02-23
5
450 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 57

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 57

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 57

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

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Help with mod_substitute 18 77
Jquery form 9 64
How do I allow for non standard CSV file 9 47
Display Error Message in Asp.net Modal Validation Partial View 3 39
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

738 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