Magento 首页 ajax 无限加载产品 js篇
7天成为Magento系统架构师,现在开始学习Magento全栈开发!
《Magento2.X企业级开发实战》
注:
本模块用的是prototype.js 的库
Magento 版本1.9x
/* *首页ajax 加载测试 *ajiang-tuzi *20160127 *www.weicot.com *其实这个js部分比较简单 */
用到的prototype.js 库中的元素
The Insertion.Bottom class
Inherits from Abstract.Insertion
在给定元素最后一个子节点位置插入 HTML。内容将位于元素的结束标记的紧前面。
Method | Kind | Arguments | Description |
---|---|---|---|
[ctor](element, content) | constructor | element: element object or id, content: HTML to be inserted | Inherited from Abstract.Insertion. Creates an object that will help with dynamic content insertion. |
The following code
Hello, Wiggum. How's it going?
Will change the HTML to
Hello, Wiggum. How's it going? What's up?
用到的 prototype.js 的库
/* *首页ajax 加载测试 *ajiang-tuzi *20160127 *www.weicot.com *其实这个js部分比较简单 */ function unfilterJSON(filter) { return this.replace(filter || Prototype.JSONFilter, '$1'); } function isJSON() { var str = this; if (str.blank()) return false; str = str.replace(/\(?:["\/bfnrt]|u[0-9a-fA-F]{4})/g, '@'); str = str.replace(/"[^"\nr]*"|true|false|null|-?d+(?:.d*)?(?:[eE][+-]?d+)?/g, ']'); str = str.replace(/(?:^|:|,)(?:s*[)+/g, ''); return (/^[],:{}s]*$/).test(str); } function evalJSON(sanitize) { var json = this.unfilterJSON(), cx = /[u0000u00adu0600-u0604u070fu17b4u17b5u200c-u200fu2028-u202fu2060-u206fufeffufff0-uffff]/g; if (cx.test(json)) { json = json.replace(cx, function (a) { return '\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); }); } try { if (!sanitize || json.isJSON()) return eval('(' + json + ')'); } catch (e) { } throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); } function parseJSON() { var json = this.unfilterJSON(); return JSON.parse(json); }
参考与引用
JavaScript 处理和解析JSON数据
转载请注明:(●–●) Hello.My Weicot » Magento 首页 ajax 无限加载产品 js篇
文章来源于互联网:Magento 首页 ajax 无限加载产品 js篇
如无特殊说明或标注,任何个人或组织,复制、转载、采集本站内容请注明:
本文来源于:【Magento中文网】,并添加本文地址链接。
如未按上述操作复制或转载,本站有权追究法律责任。
若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
本文来源于:【Magento中文网】,并添加本文地址链接。
如未按上述操作复制或转载,本站有权追究法律责任。
若本站内容侵犯了原著者的合法权益,可联系我们进行处理。