Question

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

Était-ce utile?

La solution

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top