javascript - prototype AJAX loading blank page onSuccess -
i'm working on magento project, , i'm trying load more products on click of more button.
i can see them loading load blank page after it.
i have no idea happening or why.
this code have
var loadmore = class.create({ initialize: function (list, href, pattern) { var = 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(); } } } }); } }); } });
if can me out awesome!
thanks in advance.
i've having same problem in magento iphone orginal theme, error because of code injection, "script" tags google analytics, clicktale , similar stuff.
what i've done fix "parse" ajax response , modify opening "script" tag html entity:
below line 117 (aprox in iphone.js)
if (200 == response.status) { that.holder.update(response.responsetext).select(pattern).each(function(elem) {
replace this:
str = response.responsetext; str = str.replace(/<script/gi, '<script'); that.holder.update(str).select(pattern).each(function(elem) {
Comments
Post a Comment