I am new to jQuery and hope someone can help me with this.
I have an Ajax call with the success function (data) returning an array like the below.
Now I have to loop through this and for each "tID" I have to do something with the corresponding "content".
I was thinking of using something like the following but couldn't figure out how to apply this here:
$.ajax({
type: "post",
url: "ajax.php",
cache: "false",
data: {
node: 'fetchContent',
tIDs: tIDs
},
success: function(data){
$.each(data.arr, function(index, value){
console.log(value.content);
});
}
});
Can someone help me with this ?
Example array (Ajax result):
array(3) {
[0]=>
array(2) {
["tID"]=>
int(1)
["content"]=>
string(6) "Value1"
}
[1]=>
array(2) {
["tID"]=>
int(2)
["content"]=>
string(6) "Value2"
}
[2]=>
array(2) {
["tID"]=>
int(3)
["content"]=>
string(6) "Value3"
}
}
Many thanks in advance.
.ajax.phpreturn your data?