Я работаю над проектом magento, и я пытаюсь загрузить больше продуктов по нажатию кнопки больше.prototype AJAX loading blank page onSuccess
Я могу видеть их загрузку, но после этого он просто загрузит пустую страницу после нее.
Я понятия не имею, что происходит или почему.
Это код, у меня есть
var loadMore = Class.create({
initialize: function (list, href, pattern) {
var that = this;
this.list = list;
this.list.insert({ after : '<div class="more"><span id="more_button" class="more-button">More</span></div>'});
this.href = href.readAttribute('href');
this.button = $('more_button');
this.holder = new Element('div', { 'class': 'response-holder' });
this.button.observe('click', function() {
if (!that.button.hasClassName('loading')) {
new Ajax.Request(that.href, {
onCreate: function() {
that.button.addClassName('loading');
},
onSuccess: function(response) {
if (200 == response.status) {
that.holder.update(response.responseText).select(pattern).each(function(elem) {
that.list.insert({ bottom : elem });
}),
that.href = that.holder.select('.next-page')[0].readAttribute('href');
that.button.removeClassName('loading');
if (!that.href) {
that.button.up().remove();
}
}
}
});
}
});
}
});
Если кто-то может помочь мне, что было бы удивительным!
Заранее спасибо.