0

I'm receiving a jquery (i believe) error that I cannot figure out.

The full error message in console is:

 Uncaught TypeError: Object [object Object] has no method 'listview' 

This is the snippet of code that is failing:

$.ajax({
type:"GET",
dataType:"json",
url:"viewapi.jsp",
success:function(images) {
    for (var i = 0; i < images.length; i++) {
        var image = images[i];
        addItem(image.id, image.title);
    }
    $("#allimages").listview('refresh');
}

And this is the HTML it is trying to manipulate

    <div data-role="content" class="photolist"> 
    <ul data-role="listview" data-inset="true" id="allimages"></ul>
</div>

I'm not certain why this code does not work, or where the error is coming from. Even if the get request returned nothing, it should error out before the line is it getting caught on

4
  • Have you loaded the listview widget code? Commented Feb 3, 2014 at 4:13
  • jquery-1.8.2.min.js is loaded by this point, yes Commented Feb 3, 2014 at 4:15
  • @Barmar You say widget?!? Is it in here: jquerymobile.com/download? Commented Feb 3, 2014 at 4:20
  • I didn't know listview was a standard jQuery Mobile widget (I'm mainly familiar with jQuery and jQuery UI, and your question never mentioned Mobile. Commented Feb 3, 2014 at 4:23

1 Answer 1

1

The listview function is presumably a plugin for jQuery. Has that plugin file been added to page in time? That error can mean a missing plugin.

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

2 Comments

Is jquery mobile loaded as well? I'm assuming thats the listview function that you're mentioning.
It was only being loaded conditionally, after checking if the browser was mobile. Trying to load it always just to see what happens.

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.