Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
184
rated 0 times [  186] [ 2]  / answers: 1 / hits: 8874  / 10 Years ago, wed, june 11, 2014, 12:00:00

I get the Json by using the post Method,



                    $.post('urlhere', function (data) {
alert(data.Experience)
});


If I trying to get one element from the JSON Response like alert(data.Experience).But It will show Undefined.How to get the particular node from the following Json?



Get the Response like,



[
{
Name: null,
EmployeeId: 0,
Email: null,
UserName: null,
Password: null,
JobTitle: null,
JobID: null,
SkillsRequired: Struct,
Experience: 2,
Description: null,
listval: null,
Status: null,
JobLocation: null,
JobPostedDate: /Date(-62135596800000)/,
AssignJobID: null,
AssignJobTitle: null,
AssignJobHr: null,
AssignDateofInterview: /Date(-62135596800000)/,
AssignDescription: null
}
]

More From » jquery

 Answers
2

First make sure that the JSON that you are receiving is a parsed form of json or a string, If it is a string parse it before accessing values from it like JSON.parse(data). And the second thing is the data that you are receiving is a kind of array, so you must need to specify the index to access the values inside it meaning the JSON.



Try,



alert(data[0].Experience);

[#44660] Monday, June 9, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alorac

Total Points: 262
Total Questions: 82
Total Answers: 97

Location: Libya
Member since Mon, Dec 7, 2020
4 Years ago
alorac questions
Sat, Oct 10, 20, 00:00, 4 Years ago
Tue, Sep 22, 20, 00:00, 4 Years ago
Wed, Jul 1, 20, 00:00, 4 Years ago
Wed, Jun 3, 20, 00:00, 4 Years ago
Sun, May 17, 20, 00:00, 4 Years ago
;