Вопрос

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

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top