1

i have a working bing Image search api with jsonp datatype. It's working with no problems. When i load the image search script in a Jquery UI dialog, it display properly and i'm able to search and see the results in the dialog() box. But if i close the dialog() and open it again, now if i search no results show. Looking at console.log, i do confirm the jason data is recieved, but for some reason it's not appending to the result div, so i see no result on the screen. This onyl happens if i close the dialog and open it again. If i refresh refresh the page and open the dialog again then search results are displayed.

This is what i'm using to append the results.

        $.each(data.SearchResponse.Image.Results,
        function(i, item) {
            console.log(item.Thumbnail.Url);
                $("#Results").append("<li><img style='width:100px; height:75px;' src='" + item.Thumbnail.Url + "'/></li>");
        });

1 Answer 1

1

Use firebug and check to see if the DOM is still in the container you expect. If so, check to see if a style: hidden attribute is attached to it.

It may be that you'll have to re-append the json whenever you open the dialog. If so, try checking out the jquery.tmpl.js plugin.

Sign up to request clarification or add additional context in comments.

2 Comments

where do i check for style hidden in DOM. I noticed the same happens if i opened the dialog twice. The first dialog shows the results where as the second dialog does not. Both dialogs are receiving the jsonp data, but the second one is just no appending the results.
if the style is hidden in the DOM, it would be grayed out in the Firebug inspection viewer. it should also have "style: hidden;" in the markup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.