var sdk = (function(){ var sdk = {} // var endpoint = "https://secure.api.yoox.biz/" var endpoint = "https://sandbox.api.yoox.biz/" sdk.headers = { "x-yoox-appname": "{API-TEST}", "x-yoox-api-key": "{API-KEY}", "x-yoox-device": "smartphone", } sdk.path = function(api, path){ return endpoint + api + "/STONEISLAND_US/" + path } sdk.fetch_collection = function(opt){ $.ajax({ method: "GET", url: sdk.path("Search.API/1.2", "search.json"), data: { format: "full", gallery: opt.gallery_id }, success: opt.success, }) } sdk.image = function(code){ return "http://cdn.yoox.biz/" + code.substr(0,2) + "/" + code + "_11_f.jpg" } $.ajaxSetup({ // possibly: application/json; charset=utf-8" contentType: "application/json", }) return sdk })()