I'm trying to access a getJson array I created to add image references to a option list tag. I'm trying to levy it so that user can also click a link to go to the next page. I'm fairly certain the syntax is wrong as I'm not very accustomed to jquery, could someone please help me out ?
$(function(){
$("select#chapters").ready(function(){
$.getJSON('/pageCall.php',{chapters:$('#chapters').val()}, function(data) {
var select = $('#page1');
var select = $('#page2');
var options = '';
var pageNumber = 1;
var nextPage = 0;
var prevPage = 0;
var totalPages = data.length;
var doNext = function(){
if( pageNumber > totalPages)
{
pageNumber = totalPages;
}
nextPage = pageNumber + 1;
$('#mangaImage').attr('src', data[nextPage].('imageLocation'));
};
$('.nextPage').unbind().click(function(){
doNext();
})
$.each(data, function(index, array) {
options += '<option value="' + array['imageLocation'] + '" >' + array['pageNumber'] + '</option>';
});
$("select#page1").html(options);
$("select#page2").html(options);
});
})
})