Note that there are some explanatory texts on larger screens.

plurals
  1. POHTML response in JSON
    primarykey
    data
    text
    <p>I have a JSON file such as</p> <pre><code>[ { "heading":"Apprenticeship Pathways", "image":"http:\/\/www.domain.co.uk\/dfdf\/dfdf/images\/content\/join_our_team\/01.png", "columns":[ { "data":"&lt;p&gt;Curabitursapienligulasuscipitneccondimentu mneclaciniaavelitCraslaciniaodiositametvel itpellentesquefringillaPellentesquedapibus0 purusvitaemetusultricesultricesCrasvelorci mneclaciniaavelitCraslaciniaodiositametvel velitinhendreritarcicesultricesCrasvelorci5. velitinhendreritarcicesultricesCrasvelorci5.&lt;\\p&gt;" }, </code></pre> <p>The problem being when inputting the column data, "&lt;\p>" is visible on screen, I.e. the escaped slash is not being removed.</p> <pre><code>function json_request( url, callback ) { $.ajax({ url: url, dataType: 'json', success: function( data ) { callback( data ); }, error : function(){ callback( false ); } }); } function build_html( $obj ) { var $firstCol = $obj.columns.shift(); var $columns = ''; for( var i in $obj.columns ) { $columns += '&lt;div class="hori-con"&gt;'; $columns += $obj.columns[i].data; $columns += '&lt;/div&gt;'; } var $return = ' &lt;li&gt;' + ' &lt;div class="gridRow cf"&gt;' + ' &lt;div class="twelveCol last"&gt;' + ' &lt;div class="cf hori-con-inner"&gt;' + ' &lt;div class="hori-con"&gt;' + ' &lt;img src="' + $obj.image + '"&gt;' + ' &lt;h3&gt;' + $obj.heading + '&lt;/h3&gt;' + $firstCol.data + ' &lt;a href="#" class="hori-open"&gt;open&lt;/a&gt;' + ' &lt;/div&gt;' + $columns + ' &lt;div&gt;' + ' &lt;/div&gt;' + ' &lt;/div&gt;' + ' &lt;/li&gt;'; return $return; } function filter_jobs(){ $('#join_our_team .sub-heading-bar a.nav-box').bind($bind , function(){ var $this = $(this), $qsKey = 'filter', $href = $this[0].href, $basename = $href.split('?' + $qsKey + '=')[1], $dataContainer = $('#joinOurTeamScroller ul.thelist'); if( typeof $basename !== 'undefined' ) { json_request('./json/' + $basename + '.json', function( $data ){ $html = ''; if( $data !== false ) { $.each( $data, function(key, val) { $html += build_html( val ); }); } $dataContainer.html($html); }); } return false; }); } </code></pre> <p>Is there a standardised way of doing this or do I need to search and replace the slashes?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload