/ Published in: JavaScript
Wraps Contextual Product Search of zanox Web Services
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function addScript(url) { var script = document.createElement("script"); script.src = url + '&t='+new Date().getMinutes(); script.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(script); } function productSearch(version, applicationid, adspace, region, programs, minPrice, maxPrice, category, page, items, q, callback) { var url = 'http://api.zanox.com/json/' + version + '/products?applicationid=' + applicationid; if (adspace) url += '&adspace=' + adspace; if (region) url += '®ion=' + region; if (programs) url += '&programs=' + programs; if (category) url += '&category=' + category; if (page) url += '&page=' + page; if (items) url += '&items=' + items; if (minPrice) url += '&minPrice=' + minPrice; if (maxPrice) url += '&maxPrice=' + maxPrice; if (callback) url += '&callback=' + callback; if (q) url += '&q=' + q; addScript(url); }