views:

19

answers:

0

What I am trying to do is have FB display my image, and when the title loads, I want it to have a link that will trigger a function that will set the value of a cookie to the image ID. For example. If I have a series of a 100 images, each having it's own unique ID, the link that appears in the title area of FB would have an "Add To Cart" link that fires the unique ID number to a javascript function that will set a cookie value, and append subsequent values, so that when the person is done shopping, they can make their size choices of what they want to buy, even if they have chosen 10 different images.

Javascript Code:

$("a[rel=example_group]").fancybox({ 'opacity' : true, 'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'titlePosition' : 'over', 'titleFormat' : function(title, currentArray, currentIndex, currentOpts) { return 'Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? '   ' + title : '') + '- Add To Cart'; } });

And the HTML code:

<a rel="example_group" href="./example/9_b.jpg" title="Test Title |||
<?php echo $imageUniqueID; ?>"><img alt="" src="./example/9_s.jpg" /></
a>

If I passed the whole title to the "addToCart" function then I could use the JS split function to get the UniqueID. I would prefer to not have the title look like this for the user, is there other options?

Currently the code throws an syntax error in the onclick portion of the statement.

Thank you in advance for your help! Randy