Hello I have the following AJAX call: $.ajax({ type: "POST", url: "/ajax.php?q=portfolio", data: {client_id: $('#portfolio-image').attr('class')}, async: false, success: function($data){ $data = eval('(' + $data + ')'); $id = $data[0]['id']; $title = $data[0]['title']; $image = $data[0]['image']; $('#portfolio-image').html('<img src="/assets/images/portfolio/thumbs/' + $image + '" alt="' + $title + '" title="' + $title + '" id="img-' + $id + '" />'); } }); Code (markup): I would like to access the $data variable from another page function without calling AJAX. I read that that the only way to do this is to have async: false but it hasn't helped. The reason I need to do this is that the ajax query returns an array of images, then the next and previous buttons need to simply change the position of the array. Thanks for your help
Just to let you know I have sorted this: just needed to give the variable a window.variable_name to make it global