Problem with Facebook Sharing

Asked

Viewed 73 times

0

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

It works well, 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 with no paragraph and works well.

Now all I need to fix is that the system fixes this problem automatically but I have tried with the strip_tags and did not resolve.

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 and the description

Example:

if I put straight as php will print

Description: 'One of the most acclaimed and respected Portuguese voices of fado. With more than 30 platinum records and one of the most applauded stars on the World Music circuit, Mariza returns to Multiusos de Guimarães on March 21, 2015.Considered a "complete artist, able to hypnotize' an entire audience with fado sung with soul", Mariza recently received the 2014 Womex Award in Santiago de Compostela.Mariza has sold out the most prestigious venues in the world - Carnegie Hall in New York, Sidne Opera.';

It no longer accepts and the script no longer works

If you put it like that it already works

descrition: One of the most acclaimed and respected Portuguese voices of fado. With more than 30 platinum records and one of the most applauded stars on the World Music circuit, Mariza returns to Multiusos de Guimarães on March 21, 2015.Considered a "complete artist, able to hypnotize' an entire audience with fado sung with soul", Mariza recently received the 2014 Womex Award in Santiago de Compostela.Mariza has sold out the most prestigious venues in the world - Carnegie Hall in New York, Sidne Opera.

  • Is the issue with Description? Post an example of how this script looks after PHP writes.

  • I’ve already set the example

  • Any error appears in the console?

  • No error appears

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.