function searchMarks(srchMarksFrom,srchMarksTo){
alert("search marks called: "+srchMarksFrom+ " "+srchMarksTo);
$.ajax({
type:"GET",
url:"searchForMarks.htm",
data: {
"srchMarksFrom" : srchMarksFrom,
"srchMarksTo": srchMarksTo
},
success:function(data){
console.log(data);
$.each(data,function(i,value){
alert(studOnMarks.i.id);
});
},
error: function(){
alert("ajax failure");
},
});
}//end of search me
this is the json response
{
"studOnMarks": [
{
"id": 1,
"name": "Rajan",
"tenthmarks": 70,
"dob": "1990-01-17",
"phone": 9743473763
},
{
"id": 2,
"name": "subhasish",
"tenthmarks": 78,
"dob": "1989-06-19",
"phone": 9743473763
},
{
"id": 3,
"name": "ani",
"tenthmarks": 90,
"dob": "1991-12-20",
"phone": 9743473763
}
]
}
I need to iterate through this json response. I tried the above js but it gives: Uncaught TypeError: Cannot use 'in' operator to search for '252' in {"studOnMarks":[{"id":1,"name":"Rajan","tenthmarks":70,"dob":"1990-01-17","phone":9743473763},{"id":2,"name":"subhasish","tenthmarks":78,"dob":"1989-06-19","phone":9743473763},{"id":3,"name":"ani","tenthmarks":90,"dob":"1991-12-20","phone":9743473763}]} I need to access each id, name and so on. Please help