从JSON响应我有数据显示我想要的地方,但我正在寻找一种方法来获取单个产品的数据而不是所有产品..
我之前只做了基本的ajax / json工作所以我真的不明白如何将外观数字放入网址中,例如.. wwww.somesite.com/cat/clothes/looknumber/
var REMOTE_SERVICES = {
'product-detail' : '/_ui/ajax/looks-detail-items.json',
};
return {
config : function() {
return REMOTE_SERVICES;
}
};
if (lookNumber != idFound) {
ajaxLoader.loadJson(
URL_SERVICE,
CONTAINER_ITEMS_LOOKS_GALLERY,
$activeSlide,
REMOVE_CLASS,
lookNumber
);
这是我到目前为止所做的:
$.ajax({
url: jsonUrl[url.toUpperCase()],
dataType: 'json'
}).done(function(response) {
response = (url == 'looks-detail')? [response, look] :
response;
resultObject = jsonHtml.compiler(response, url);
if (resultObject.hideButton) {
$link.hide();
}
loader.loadRepsonseInContainer(
$container,
$(resultObject.html),
$link,
$('.' + removeElementsClass)
);
}).fail(function() {
loader.showLoadError($container, $link);
});
}
添加data.lookNumber ..但我不明白那是什么
答案 0 :(得分:0)
suppose you have json variable named 'data'
$.ajax({
url : "wwww.somesite.com/cat/clothes/" + data.lookNumber +"/",
data : {...}
});
you can use like data.lookNumber