具有prettyPhoto的Instagram API

I am trying to add prettyPhoto to my pictures from my instagram feed on my website which can be seen at www.dirtycookie.co

I can successfully pull the pictures from the instagram API however, I cannot add the prettyPhoto functionality to the pictures in the feed. Here is my ajax call with the prettyPhoto hook:

<script>

$(function() {
    $.ajax({
        type: "GET",
        dataType: "jsonp",
        cache: false,
        url: "https://api.instagram.com/v1/users/<?=$user_id?>/media/recent/?access_token=13137.f59def8.1a759775695548999504c219ce7b2ecf",
        success: function(data) {
            for (var i = 0; i < <?=$num_to_display?>; i++) {
           jQuery('.instagram').append('<div class="instagram-placeholder"><a href="' + data.data[i].images.standard_resolution.url + '"  rel="prettyPhoto"><img alt="'+ data.data[i].caption.text +'" class="instagram-image" src="' + data.data[i].images.thumbnail.url +'"/></a></div>');  
            }     

        }
    });
});

</script>

It almost behaves as if the jquery.prettyPhoto.js is not being called, I have confirmed it is in the /js/ folder.

Here is my init script and the bottom of the body:

<script type="text/javascript" charset="utf-8">
  $(document).ready(function(){
    $("a[rel^='prettyPhoto']").prettyPhoto();
  });
</script>

Using Firebug I can see the Ajax is putting in the rel="prettyPhoto" properly.

Anyone have any suggestions?

Thanks, Chris

You are attaching the prettyPhoto() function on the anchors at 'domready', even before the content is pulled in from the AJAX call. Hence its not working. Try this.

$(function() {
    $.ajax({
        type: "GET",
        dataType: "jsonp",
        cache: false,
        url: "https://api.instagram.com/v1/users/<?=$user_id?>/media/recent/?access_token=13137.f59def8.1a759775695548999504c219ce7b2ecf",
        success: function(data) {
            for (var i = 0; i < <?=$num_to_display?>; i++) {
           jQuery('.instagram').append('<div class="instagram-placeholder"><a href="' + data.data[i].images.standard_resolution.url + '"  rel="prettyPhoto"><img alt="'+ data.data[i].caption.text +'" class="instagram-image" src="' + data.data[i].images.thumbnail.url +'"/></a></div>');  
            }     
$("a[rel^='prettyPhoto']").prettyPhoto();

        }
    });
});