pass php array to jquery with getJSON
Posted
by robertdd
on Stack Overflow
See other posts from Stack Overflow
or by robertdd
Published on 2010-04-22T06:33:58Z
Indexed on
2010/04/22
6:43 UTC
Read the original article
Hit count: 250
i want to pass a php aray to jQuery:
$.getimagesarr = function() {
$.getJSON('operations.php', {'operation':'getimglist'}, function(data){
var arr = new Array();
arr = data;
return arr;
});
}
var data = $.getimagesarr();
if (data){
jQuery.each(data, function(i, val) {
....
});
}
it return undefined
in php i have this:
function getimglist(){
$results = $_SESSION['files'];
echo json_encode($results);
}
it is possible?
© Stack Overflow or respective owner