I have this URL shown below:
http://www.myServer.net/Posters/CU_Pete'sChristmas_PP.png
Now this is
{
'title' : 'Pete\'s Christmas',
'description' : 'A light-hearted holiday tale that even adults will enjoy. A young boy has the worst Christmas ever and soon realises that he’s doomed to repeat the same day over and over again.',
'thumbnail' : ['http://www.myServer.net/Posters/CU_Pete'sChristmas_PP.png'],
'large' : ['http://www.myServer.net/Posters/CU_Pete'sChristmas_PP.png'],
'button_list' :
[
{ 'title':'Demo', 'url' : 'index.php', 'new_window' : true }
],
'tags' : ['Movies']
}
So the problem is that Url contains special character ('), which apparently is not allowing my java script to be proper.
So the script is not executing as intended to do.
This is my javaScrit array generator
$javascript = array();
$count = sizeof($vodAssetArray);
for ($i = 0; $i < $count; $i++)
{
$pieces = explode("/", $vodAssetArray[$i]->genre);
$javascript[] = "
{
'title' : '" . addslashes($vodAssetArray[$i]->title) . "',
'description' : '" . addslashes($vodAssetArray[$i]->description) . "',
'thumbnail' : ['" . ($vodAssetArray[$i]->posterUrl) . "'],
'large' : ['" . ($vodAssetArray[$i]->posterUrl) . "'],
'button_list' :
[
{ 'title':'Demo', 'url' : 'index.php', 'new_window' : true }
],
'tags' : ['" . $pieces[0] . "']
}";
}
I tried using urlencode, rawurlencode, json_encode, but still the images are not getting downloaded.
<script type="text/javascript">
$(function(){
$("#demo").grid({
'genre' : 'All',
'items' :
[
<?php echo implode(',', $javascript); ?>
]
});
});
</script>
Please help me on this.