I've tried to use setinterval to allow my ajax request to send every 2 seconds but it keeps crashing the page, So I think something is going wrong!
Here is my code:
var fburl = "http://graph.facebook.com/http://xzenweb.co.uk?callback=?";
//getting facebook api content
$.getJSON(fburl, function(data){
var name = data["shares"];
var dataString = 'shares='+name;
//sending share count data to server
$.ajax({
type: "POST",
url: "index.php",
data: dataString,
cache: false,
success: function(html)
{
$("#content").html(html);
}
});
return false;
});
I'm new to both ajax and javascript, would really appreciate it if you could help me out :)