문제

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