I have a jquery ajax request as follows;
$.ajax({
type: 'POST',
url: 'ajax.php',
dataType: 'json',
cache: false,
success: function(result) {
alert (result);
},
});
The returned result is in JSON. To see the data, I alerted it and is as below;
img1.jpg,img2.jpg,img3.jpg,img4.jpg
The php file is as;
<?php
$array = array("img1.jpg","img2.jpg","img3.jpg","img4.jpg");
echo json_encode($array);
?>
it echos;
["img1.jpg","img2.jpg","img3.jpg","img4.jpg"]
I want to alert filename for each file name. How can I do this?
JSON version