0
I would like to pass a text with multiple in a Javascript function that is mounted in PHP.
public function change_meta_info_icon($property)
{
if($property['metas'] && $property['metas']['socialdb_property_help'] && !empty(trim($property['metas']['socialdb_property_help']))){
?>
<button onclick="showHelpText('<?php echo ($property['metas']['socialdb_property_help']) ?>');" class="btn btn-default btn-xs">Ajuda</button>
<?php
}
?>
<?php
}
The function showHelpText should receive the text and pass it to a modal window but as the text has ' n', parentheses, quotes and everything else this generating problems.
You want to return something in php to js is that it? Why don’t you try going through json?
– Gustavo Souza
Have several ways to solve one of them is to escape your quotes from showhelptext("..., The other is to put all content in a hidden div for example is to pass the id of div as a parameter of your function ...
– Jefferson Otoni Lima
Thanks, I ended up using the hidden div with the text.
– Andre Alvim
@Andrealvim If solved your problem. Mark as solved.
– Vinícius