【问题标题】:input src data from json从 json 输入 src 数据
【发布时间】:2015-02-08 18:53:43
【问题描述】:

我在这里遇到了一个非常相似的问题: jQuery progressbar with ajax request to json

你能帮我解决一下吗?

我尝试从 *.json 文件中获取路径并将其用于带有 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" }

由于jQuery progressbar with ajax request to json,我们会很高兴有类似的解决方案!

谢谢

【问题讨论】:

    标签: jquery json input src


    【解决方案1】:

    你为什么不使用 $.getJSON() http://api.jquery.com/jquery.getjson/

    【讨论】:

      猜你喜欢
      • 2020-03-30
      • 2023-03-29
      • 1970-01-01
      • 2016-04-29
      • 2011-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多