JQuery Ajax response not triggering success

Posted by Mohammad on Stack Overflow See other posts from Stack Overflow or by Mohammad
Published on 2010-05-22T09:28:31Z Indexed on 2010/05/22 9:30 UTC
Read the original article Hit count: 455

Filed under:
|
|
|

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!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX