I'm using the following code to get the latest tweets from a specific hashtag
$(document).ready(function(){
getLatestTweets();
function getLatestTweets(){
var url = "http://search.twitter.com/search.json?q=%23syria&result_type=recent&rpp=3&callback=?";
$.getJSON(url, function(json){
alert('reached');
var html = '<ul>';
$.each(json.results, function( key, result){
html += '<li><a href="#">' + '> ' + result.text + ' ...' + '</a></li>';
});
html += '</ul>';
$('#archive-twitter').append(html);
});
}
});
this code was working fine two days ago but it stopped working today. now the getJSON method won't succeed even though that when i use the following link
http://search.twitter.com/search.json?q=%23syria&result_type=recent&rpp=3
in the browser i get the actual json data
i don't know what is the problem?
UPDATE: i added a test link to clarify the problem http://latakiancoder.com/twitter-test.php
I've tried proxified server side the request and works:
JS code:
$(document).ready(function(){
getLatestTweets();
function getLatestTweets(){
var url = "http://search.twitter.com/search.json?q=%23syria&result_type=recent&rpp=3";
$.getJSON("proxy.php", { url: url }, function(json){
var html = '<ul>';
$.each(json.results, function( key, result){
html += '<li><a href="#">' + '> ' + result.text + ' ...' + '</a></li>';
});
html += '</ul>';
$('#archive-twitter').append(html);
});
}
});
proxy.php code:
<?php
$url = $_GET['url'];
$json = file_get_contents($url);
echo $json;
?>