I have a php file that's create a .txt file with name of some photos. But constantly new photos are being added to the images folder. On my index page, I have a javascript function that call the ajax function, because I don't want to reload the page. I just want to request again the php file to recreate the .txt file with the name of all photos again. Can someone help me with the ajax?
I would use JQuery for this as it'll become much easier.
$.ajax({
url: 'path/createtextfile.php',
success: function(data) {
alert('textfile created');
}
});
As this stands right now it returns a result from createtextfile.php and does a alert.
However if your file returns the names of all the pictures in a list (delimitered of course)
Example: name1, name2, name3
you can then explode this list into an array and use JQuery again to create html elements to display the names.