Reputation: 1484
I have a application with few pictures and when user check a picture, he gets a +1 score. I display the total score on page with this code:
total score: <span id="perk1"></span>
my script is:
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
var actor=0;
$(document).ready(function() {
$('#perk1').html(actor);
$("#img100").click(function() {
if($('#img100').is(':checked'))
actor=actor+1;
else if(actor>0)
actor=actor-1;
$('#perk1').html(actor);
});
$("#img95").click(function() {
if($('#img95').is(':checked'))
actor=actor+1;
else if(actor>0)
actor=actor-1;
$('#perk1').html(actor);
});
});
});//]]>
HTML:
<div class="imgs">
<div class="thumb">
<label for="img100"><img src="priyanka_chopra\gunday.jpg" height="200" width="275"/></label>
<input type="checkbox" class="chk " id="img100" name="img100" value="0" />
<label for="img95"><img src="priyanka_chopra\krrish3.jpg" height="200" width="275"/></label>
<input type="checkbox" class="chk " id="img95" name="img95" value="0" />
</div>
Everything works fine. Now i want a share to facebook button which can publish my score on facebook. I was able to share the whole page to facebook but it will show score as 0. I want my score to be saved and then display in facebook as a dialog box or full html page.
Upvotes: 1
Views: 245
Reputation: 589
You can pass points like get parameter or hash, for example
and then just get them on document load in js, or just if you use php just get this parameter and generate page with points.
Upvotes: 1