Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在HTMl页面中显示JSON数据_Json_Html - Fatal编程技术网

如何在HTMl页面中显示JSON数据

如何在HTMl页面中显示JSON数据,json,html,Json,Html,我有一个HTML网页,我想在HTML网页中显示JSON格式的数据,以便只在HTML网页中对JSON数据中的名称进行分组 这是数据URL http://www.celeritas-solutions.com/pah_brd_v1/productivo/getGroups.php?organizationCode=att&userId1 我在网上搜索它得到本地JSON数据,但是如何使用URL作为我的数据来访问数据这里是我得到的本地JSFIDLE var obj = $.parseJSON

我有一个HTML网页,我想在HTML网页中显示JSON格式的数据,以便只在HTML网页中对JSON数据中的名称进行分组

这是数据URL

 http://www.celeritas-solutions.com/pah_brd_v1/productivo/getGroups.php?organizationCode=att&userId1
我在网上搜索它得到本地JSON数据,但是如何使用URL作为我的数据来访问数据这里是我得到的本地JSFIDLE

var obj = $.parseJSON('{"common_search":{"strBusinessName":"Sun Shine Vision","strAddress":"Amulia St Madhava Pharmacy Jn","intPhone":""}, "cache_table":{"Details":"Speedtrax,Ample\'s Bldg Off Banerji Rd., Amulia St,"}}');

$("#common_serachdiv").html(obj.common_search.strBusinessName);
$("#cache_table").html(obj.cache_table.Details);

您可能希望使用jquery ajax调用url

例如


请参见

根据url提供的真实数据,我已更新了我的问题。我认为在JSFIDLE中不可能做到这一点,如果你正在访问一个外部网站,请考虑
var url = 'http://www.celeritas-solutions.com/pah_brd_v1/productivo/getGroups.php?organizationCode=att&userId1';

$("#common_serachdiv").html(url);
$.getJSON(url, function(data) {
}.done(function( data ) {
    $.each( data.items, function( i, item ) {
        $("#common_serachdiv").html(item.GroupTitle);
    }
}