【发布时间】:2018-01-03 13:33:18
【问题描述】:
我有一个系统,我在我的 mysql 数据库的每一行中存储 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];
这显示错误,所以我如何分隔每个 url 并从中获取:
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",];
我需要一些帮助。
【问题讨论】:
标签: javascript php mysql arrays ajax