从json输入src数据 [英] input src data from json

查看:318
本文介绍了从json输入src数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里有一个非常相似的问题: jQuery进度条,其中包含对json的ajax请求

I got a very similar question here: jQuery progressbar with ajax request to json

您能在这里为我提供解决方案吗?

Can you help me here with a solution?

我尝试从* .json文件中获取路径,并将其用于jquery的输入图像字段".

I try to get the path out of a *.json file and use it for an "input image field" with 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/

Why don't you use $.getJSON() http://api.jquery.com/jquery.getjson/

这篇关于从json输入src数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆