JQuery Ajax response not triggering success
- by Mohammad
This is my code,
$.ajax({
type:"get",
//this doesn't work
//url:'http://example.com/json.php',
//But this works
url:'http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?',
dataType:"jsonp",
success:function(data){
alert('success');
},
error:function(){
alert('error');
}
});
in json.php I have
<?php
header("Content-type: application/javascript");
?>
Then I've copied all the output of that flickr url. So the problem shouldn't be in the content of my code but how it's being sent. What do i need to fix here?
Thanks in advance!