Problem with Facebook sharing

0

I have a javascript s script that shares me certain posts on my page where the content it shares and automatically generated from the database.

It works fine, the only problem I'm having is with the description when I call the variable that contains the text and the script stops working. I put the same text but directly on the page and noticed that with paragraphs it accuses error so I put the text followed without any paragraph and it works well.

Now all I need to do is to have the system fix this problem automatically, but I already tried with strip_tags and it did not work.

Script

<script>
$(document).on("click", "#share_fb_<?= $row_posts_home->id; ?>", function(e) { 
  FB.ui({
    method: 'feed',
    link: 'http://sabeonde.pt',
    picture: 'http://sabeonde.pt/gtm/anexos/posts_home/<?= $row_posts_home_anexos->id_anexo ?>.<?= $row_posts_home_anexos->tipo ?>',
    name: '<?= $row_posts_home->titulo; ?>',
    caption: 'SabeOnde',
    description: '<?= strip_tags($row_posts_home->descricao); ?>'
  });
});
</script>

Yes, the problem is in description

Example:

If I put it directly as php will print

description: 'One of Portugal's most acclaimed and respected voices. With more than 30 platinum records and one of the most acclaimed stars in the World Music world circuit, Mariza returns to Guimarães Multiusos on March 21, 2015. Considered a "complete artist capable of 'hypnotizing' an entire audience with fado sung with soul, "Mariza recently received the Womex 2014 award in Santiago de Compostela. Mariza has already sold out the most prestigious venues around the world - Carnegie Hall in New York, Sydney Opera House.

It no longer accepts and the script no longer works

If you put it this way it works

Descrition: One of the most acclaimed and respected Portuguese voices of fado. With more than 30 platinum albums and one of the most acclaimed stars of the World Music World Circuit, Mariza returns to Guimarães Multiusos on March 21, 2015. Considered a "complete artist, capable of 'hypnotizing' an entire audience with fado sung with soul," Mariza recently received the Womex 2014 award in Santiago de Compostela. Mariza has already sold out the most prestigious rooms around the world - Carnegie Hall in Nova York, Sydney Opera House.

    
asked by anonymous 19.03.2015 / 04:11

0 answers