我有一个系统,用于将url文件存储在mysql数据库的每一行中。我想使用这些数据将其放入一个数组中,并在javascript函数中使用它。例如:如何将url文件放入javascript中的数组列表中
var files_list = "https://example.com/file1.docx,https://example.com/file2.docx,https://example.com/file3.docx,"; //value obtained via ajax
var links = [files_list];
这说明错误,所以我怎么能分隔每个网址,并从中得到:
var links = ["https://example.com/file1.docx,https://example.com/file2.docx,https://example.com/file3.docx,"];
要这样:
var links = ["https://example.com/file1.docx","https://example.com/file2.docx","https://example.com/file3.docx",];
我想一些帮助。