I guess I must be using the plugin wrong. I am trying to make sure
that the second AJAX request does not start until the Session.ID
variable (from the first call) was set.
The second call never gets properly executed (below) because
Session.ID is still undefined....
So I guess I'm doing something wrong still, but what exactly?


                <script type="text/javascript">
                        $(document).ready(function(){
                                var Session={};

                                function setSessionID(data){
                                        Session.ID=data.Login.Session.id;
                                        $("#msg").append("<li>Successful 
Request!</li>"+Session.ID);
                                };

                                function showImages(data){
                                        var html = "";
                                        $.each(data.Images, 
function(entryIndex, entry){
                                                html += '<li><a 
href="'+entry.LargeURL+'" title="'+entry.Caption
+'"><img src="'+entry.ThumbURL+'"/></li></a> ';  //entry['ThumbURL']
seems to work too
                                        });
                                        html = '<ul 
class="imgURL">'+html+'<\/ul>';
                                        $('#msg').append(html);
                                }

                                $.ajax({
                                        mode:           "queue",
                                        url: 
"http://api.smugmug.com/services/api/json/1.2.1/?
method=smugmug.login.anonymously&APIKey=SmrIci1yMsueIhYvSoQPu0DzQ2isLxme&JSONCallback=?",
                                        dataType:       "jsonp",
                                        success: function(data){
                                                setSessionID(data);
                                        }
                                });

                                $("#msg").append("<li>Wait for Queue to finish: 
</
li>"+Session.ID);

                                $.ajax({
                                        mode:           "queue",
                                        url: 
"http://api.smugmug.com/services/api/json/1.2.1/?
method=smugmug.images.get&Heavy=1&APIKey=SmrIci1yMsueIhYvSoQPu0DzQ2isLxme&SessionID="+Session.ID
+"&AlbumID=3133697&JSONCallback=?",
                                        dataType:       "jsonp",
                                        success: function(data){
                                                showImages(data);
                                        }
                                });

                                $("#msg").append("<li>Still waiting for Queue 
to finish: </
li>"+Session.ID);

                        });
                </script>

Reply via email to