& Times x is escaped to a solution of

 

Scene Project : back from the background data to be processed into a h5 codes and then render the page, the result is escaped as & times x.

 

 

Solution : There & times to string words into text.

 

Code is as follows :

    <div id="content"></div>
<script>
        var dataArr = [{
            "url":"www.aa.com?data={{data}}&timestamp={{timestamp}}"
        },{
            "url":"www.bb.com?data={{data}}&timestamp={{timestamp}}"
        }];
        var nodeStr ='<table>';
        for(var i=0; i<dataArr.length; i++){
            nodeStr += '<tr><td class="mark">'+ dataArr[i].url +'</td></tr>'
        }
        nodeStr += '</table>'
        $('#content').append(nodeStr);
        // & times to prevent the escape of x, on the append () method 
        for (var I = 0; I <dataArr.length; I ++ ) { 
            var URL = dataArr [I] .url; 
            $ ( 'Mark.' ). EQ (I) .text (URL); 
        }

</ Script>

 

 The results are as follows :

 

Guess you like

Origin www.cnblogs.com/Fourteen-Y/p/11428291.html