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?
问问题
134 次
1 回答
1
我会为此使用 JQuery,因为它会变得容易得多。
$.ajax({
url: 'path/createtextfile.php',
success: function(data) {
alert('textfile created');
}
});
就目前而言,它从 createtextfile.php 返回结果并发出警报。
但是,如果您的文件返回列表中所有图片的名称(当然是分隔的)
例子:name1, name2, name3
然后,您可以将此列表分解为一个数组并再次使用 JQuery 创建 html 元素以显示名称。
于 2012-07-04T18:32:27.927 回答