Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/461.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
Javascript 在解析的json结果上放置一个链接_Javascript_Jquery_Json_Html - Fatal编程技术网

Javascript 在解析的json结果上放置一个链接

Javascript 在解析的json结果上放置一个链接,javascript,jquery,json,html,Javascript,Jquery,Json,Html,我有一个json: [{"Nr SAT":"SAT000000002573","Data":"25\/08\/2008","Tipo Servizio":"GR","Stato":"ciao","Attributo":"APERTURA SAT SU IMEI DUPLICATO","Marca":"LG","Modello":"U830","Modello Guasto":"353142010979931"},{"Nr SAT":"SAT000000002574","Data":"25\/04

我有一个json:

[{"Nr SAT":"SAT000000002573","Data":"25\/08\/2008","Tipo Servizio":"GR","Stato":"ciao","Attributo":"APERTURA SAT SU IMEI DUPLICATO","Marca":"LG","Modello":"U830","Modello Guasto":"353142010979931"},{"Nr SAT":"SAT000000002574","Data":"25\/04\/2012","Tipo Servizio":"GR","Stato":"ahhhhhhhhhhhhh","Attributo":"APERTURA SAT SU IMEI DUPLICATO","Marca":"LG","Modello":"U830","Modello Guasto":"353142010979931"},{"Nr SAT":"SAT000000002575","Data":"15\/08\/2012","Tipo Servizio":"Vedi anche me","Stato":"ahhhhhhhhhhhhh","Attributo":"APERTURA SAT SU IMEI DUPLICATO","Marca":"LG","Modello":"U830","Modello Guasto":"353142010979931"}]
通过这段代码,我解析了json:

<!doctype html>
<html>
<head>
    <title>Parsing</title>
    <script type="text/javascript" src="js/jquery-2.1.0.min.js"></script>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
</head>
<script>

    $.getJSON(
        'http://sath3g.altervista.org/index.php', { get_param: 'value' }, 
        function(data) {
        // 'data' is an array of objects here
        for(var i=0; i<data.length; i++) {
        //data[i] is an individual line of excel data
            $('body').append($('<p>').html('Numero SAT: '+ data[i]["Nr SAT"]));
            $('body').append($('<p>').html('Data: '+ data[i]["Data"]))

            }
        });
</script>

    <body> 
    </body>  
</html>

解析
$.getJSON(
'http://sath3g.altervista.org/index.php“,{get_param:'value'},
功能(数据){
//“数据”是此处的对象数组

对于(var i=0;i如果您所说的数字是指
Nr SAT
,那么您可以这样尝试-

 $('body').append(
         $('<p>').html('Numero SAT: '+ data[i]["Nr SAT"])
                 .wrap($('<a>').prop('href','http://yourDomain.com/something/'))
 );
$('body')。追加(
$(“”).html('Numero-SAT:'+data[i][“Nr-SAT]”)
.wrap($('').prop('href','http://yourDomain.com/something/'))
);
为什么不这样做:

$('body').append('<p><a href = http://yourlink.com>'data: '+ data[i]["Data"]</a></p>')
$('body')。追加('

'))
我没有看到任何变化。我不知道为什么。我通过以下方式解决了问题:$('body')。append($('p>')).html('Numero Sat:'+'');