Question

I know this question might have been asked before, but I have not yet found a way to solve my issue.

On this page, if you click on Webster on the left, you can see the part that says <b>test html</b><br />. I need that to be rendered correctly on the page.

Here is the data that gets saved to the database: &lt;b&gt;test html&lt;/b&gt;&lt;br /&gt;

And here is how I display it on the page (the problematic area is store_details):

contentPane.html('');

html = '<div onclick="showStoreDetails(\'item_store_'+j+'\')" class="custom-location-wrapper"><div class="wk_st_product_gen" id="item_store_'+ j +'" onmouseout="offhighlightMarker('+j+')" onmouseover="highlightMarker('+j+')" onclick="showcontent(\''+store_title+'\',\''+store_address+'\',\''+store_link+'\',\''+j+'\')"><input type="hidden" class="position" id="'+str_dis;
html+= '"><input type="hidden" id="str_lati" value="'+store_latitude;
html+= '"><input type="hidden" id="str_longi" value="'+store_longitude;
html+= '"><div class="store_info"><img alt="store" src="<?php echo HTTP_SERVER;?>image/webkul-store-locater/'+store_image;
html+= '"> <div class="store_address"><div class="store_title">'+store_title;
html+= '</div><div class="store_details"><p class="store_addressline" >'+store_address;
html+= '</p><p class="store_locality">'+store_local;
html+= '</p><p class="store_distance">'+store_distance;
html+= '</p><p>'+store_details;
html+= '</p></div></div></div></div>';
html+= '<style>#alert_red{display:none;}</style>';

contentPane.append(html);
Was it helpful?

Solution

You can just use html_entity_decode in PHP to decode you data before retrieving it.

us3.php.net/html_entity_decode

OTHER TIPS

Take a look at the Lo-Dash library (based on underscore). It has an _.unescape method that does this:

http://lodash.com/docs#unescape

html+= '</p><p>'+_.unescape(store_details);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top