从 json 输入 src 数据
input src data from json
我在这里遇到了一个非常相似的问题:
你能帮我解决这个问题吗?
我尝试从 *.json 文件中获取路径并将其用于 "input image field" 和 jquery.
HTML
<input id="pic_1" type="image" src="<!-- what to do here? -->" />
JS
$(function() {
$.ajax({ dataType:"json",
url: test.json,
success: <!-- what to do here? -->,
});
});
test.json
{ "pic_1":"img/test.png" }
会很高兴有类似的解决方案,由于 !
谢谢
你为什么不使用 $.getJSON() http://api.jquery.com/jquery.getjson/
我在这里遇到了一个非常相似的问题:
你能帮我解决这个问题吗?
我尝试从 *.json 文件中获取路径并将其用于 "input image field" 和 jquery.
HTML
<input id="pic_1" type="image" src="<!-- what to do here? -->" />
JS
$(function() {
$.ajax({ dataType:"json",
url: test.json,
success: <!-- what to do here? -->,
});
});
test.json
{ "pic_1":"img/test.png" }
会很高兴有类似的解决方案,由于
谢谢
你为什么不使用 $.getJSON() http://api.jquery.com/jquery.getjson/