我必须赞扬初等人物的成果,但并不奏效。 这就是我所做的工作。
var pid = $("#pid").val();
var catalog = $("#catalog_name").val();
var qty = $("#qtys").val();
var params = {
productid: pid,
catalog: catalog,
ref: "Makegoodmedia",
quantity: qty,
command: "Add",
modules: "PersonalizedAnalytics,PersonalizedBasket",
Section: "home",
"__lang": "en-CA",
lang: "en-CA"
};
$.ajax(
{
url: "http://www.chapters.indigo.ca/Checkout/AddToBasket.ashx?callback=jsonresult",
type: "GET",
data: params,
dataType: "jsonp",
cache: false,
error: function (request, status) {
$("#_dialog1 .dialogHeader").css("display","block");
$("#_dialog1 .dialogBodylOAD").css("display","none");
$("#_dialog1 .dialogBody").html("<p class= Error >Sorry But there is a Error</p>");
},
success: function (data) {
alert(data);
// $.each(data, function(i,item){
// alert(i+item);
// });
$("#_dialog1 .dialogHeader").css("display","block");
$("#_dialog1 .dialogBodylOAD").css("display","none");
$("#_dialog1 .dialogBody").html(data.jsonresult[0].PersonalizedBasket[0]);
}
});
This is the final URL for the above Ajax call.
http://www.chaps.indigo.ca/Checkout/AddToBasket.ashx? callsback=jsonresult&productid=9780143170099&quantity=1&catalog=books&ref=Makegoodmedia&command=Add&moduerson=PalizedAnalytics,PersonalizedBasket=home§ion=home&_lang=en-CAlogigo&lang=en-CA'rel=
在这里,我看到了“智者”的实际结果。
jsonresult({
PersonalizedAnalytics: "// Analytics
s.pageName="activebasket:add to basket";
s.server="204WP-9270 - BrowseOnline";
s.channel="basket";
s.pageType="";
s.prop1="";
s.prop2="";
s.prop3="";
s.prop4="";
s.prop5="";
s.prop6="";
s.prop7="";
s.prop8="";
s.prop9="";
s.prop10="";
s.prop11="";
s.prop12="";
s.prop13="";
s.prop14="";
s.prop15="";
s.prop16="";
s.campaign="";
s.state="";
s.zip="";
s.events="";
s.products="";
s.purchaseID="";
s.eVar1="";
s.eVar2="";
s.eVar3="";
s.eVar4="";
s.eVar5="";
s.eVar7="";
s.eVar8="";
s.eVar9="";
s.eVar10="";
s.eVar11="";
s.eVar12="";
s.eVar21="";
s.eVar22="";
s.t();",PersonalizedBasket:
{
"popUpHTML": <div class="dialogHeader group"><a title="close" href="#"></a><h4>Not Added</h4></div> +
<div class="dialogBodyShoppingBagPopUp"><div class="shoppingBagPopUpError">Please note that one or more items were removed from your basket because the product is no longer sold.<br /></div> +
<p><a id="ctl00_ctl06_linkShoppingBagPopUpItem"></a> +
<br /> +
</p> +
<div class="shoppingBagPopupButtons"><a id="ctl00_ctl06_linkShoppingBagPopUpCheckout" class="shoppingBagPopUpCheckout" href="http://www.chapters.indigo.ca/Checkout/ShoppingBag.html?Lang=en-CA&ReferringSection=home&Redirect=">Checkout Now</a> +
<a id="ctl00_ctl06_linkShoppingBagPopUpContinueShopping" class="btnContinueShopping" href="Checkout/#">Continue Shopping</a></div></div><!--[if lte IE 6.5]><iframe class="dialogIE6Fix" src="javascript:false;"></iframe><![endif]--> ,
"miniPopUpHTML": <div id="ctl00_ctl06_myCartWidgetContainer" class="myCartWidgetContainer"><a href="#" class="myCartWidgetContainerClose"></a><div class="myCartWidgetHeader group"><h1>My Cart: 30 Items</h1><a id="ctl00_ctl06_myCartBtnCheckoutTop" class="addToCart" href="http://www.chapters.indigo.ca/Checkout/ShoppingBag.html?Lang=en-CA&ReferringSection=home&Redirect=">Checkout</a></div> +
<div class="shoppingBagMainContent"><div class="shoppingBagHeadings group"> +
<div class="shoppingBagCol1">Item</div> +
<div class="shoppingBagCol2">Description</div><div class="shoppingBagCol3">Qty</div> +
<div class="shoppingBagCol4">Unit Price / <a href="http://www.chapters.indigo.ca/iRewards-program-information-page/irewardsInfo-art.html">Member Price</a></div> +
</div><div id="shoppingBagGroupsWrapper"><div class="shoppingBagItemRow group" ID="shoppingBagItemRow"><div class="shoppingBagCol1">Crossfire<br /><a href="http://www.chapters.indigo.ca/books/Crossfire-Dick-Francis/9780718156633-item.html">View Details >></a></div><div class="shoppingBagCol2">Hardcover</div><div class="shoppingBagCol3"><input type="text" value="2" maxlength="2" /><div class="shoppingBagCol3Options"><a href="#" class="shoppingBagUpdateQtyWidget" productId="978071815663" catalog="books" origQuantity="2">Update Quantity</a><br /><a href="http://www.chapters.indigo.ca/Checkout/ShoppingBag.html?productid=978071815663&catalog=books&vid=&command=Delete&scSku=9780718156633&scTitle=Crossfire&scCatalogue=Book" class="shoppingBagRemoveWidget">Remove</a></div></div><div class="shoppingBagCol4"><span>$22.44 / <a href="http://www.chapters.indigo.ca/iRewards-program-information-page/irewardsInfo-art.html">$21.32</a></span><div class="shoppingBagItemSubTotal"><span>x2 subtotal: $44.88</span><span><a href="http://www.chapters.indigo.ca/iRewards-program-information-page/irewardsInfo-art.html">member</a> subtotal: $42.64</span></div></div></div><div class="shoppingBagItemRow group shoppingBagItemRowAlt" ID="shoppingBagItemRow"><div class="shoppingBagCol1">Pharmacy Bath Soak Detox<br /><a href="http://www.chapters.indigo.ca/gifts/Pharmacy-Bath-Soak-Detox/609197010870-item.html">View Details >></a></div><div class="shoppingBagCol2">Gift & Paper</div><div class="shoppingBagCol3"><input type="text" value="2" maxlength="2" /><div class="shoppingBagCol3Options"><a href="#" class="shoppingBagUpdateQtyWidget" productId="60919701087" catalog="gifts" origQuantity="2">Update Quantity</a><br /><a href="http://www.chapters.indigo.ca/Checkout/ShoppingBag.html?productid=60919701087&catalog=gifts&vid=&command=Delete&scSku=609197010870&scTitle=Pharmacy+Bath+Soak+Detox&scCatalogue=Gift" class="shoppingBagRemoveWidget">Remove</a></div></div><div class="shoppingBagCol4"><span>$22.95</span><div class="shoppingBagItemSubTotal"><span>x2 subtotal: $45.90</span></div></div></div><div class="shoppingBagItemRow group" ID="shoppingBagItemRow"><div class="shoppingBagCol1">Quotable Magnet Good Friends<br /><a href="http://www.chapters.indigo.ca/gifts/Quotable-Magnet-Good-Friends/665475511750-item.html">View Details >></a></div><div class="shoppingBagCol2">Gift & Paper</div><div class="shoppingBagCol3"><input type="text" value="1" maxlength="2" /><div class="shoppingBagCol3Options"><a href="#" class="shoppingBagUpdateQtyWidget" productId="66547551175" catalog="gifts" origQuantity="1">Update Quantity</a><br /><a href="http://www.chapters.indigo.ca/Checkout/ShoppingBag.html?productid=66547551175&catalog=gifts&vid=&command=Delete&scSku=665475511750&scTitle=Quotable+Magnet+Good+Friends&scCatalogue=Gift" class="shoppingBagRemoveWidget">Remove</a></div></div><div class="shoppingBagCol4"><span>$6.99</span></div></div><div class="shoppingBagItemRow group shoppingBagItemRowAlt" ID="shoppingBagItemRow"><div class="shoppingBagCol1">Wild Ginger & Fresh Fig Bar Soap<br /><a href="http://www.chapters.indigo.ca/gifts/Wild-Ginger-Fresh-Fig-Bar/839918001584-item.html">View Details >></a></div><div class="shoppingBagCol2">Lucia</div><div class="shoppingBagCol3"><input type="text" value="10" maxlength="2" /><div class="shoppingBagCol3Options"><a href="#" class="shoppingBagUpdateQtyWidget" productId="83991800158" catalog="gifts" origQuantity="10">Update Quantity</a><br /><a href="http://www.chapters.indigo.ca/Checkout/ShoppingBag.html?productid=83991800158&catalog=gifts&vid=&command=Delete&scSku=839918001584&scTitle=Wild+Ginger+%26+Fresh+Fig+Bar+Soap&scCatalogue=Gift" class="shoppingBagRemoveWidget">Remove</a></div></div><div class="shoppingBagCol4"><span>$10.00</span><div class="shoppingBagItemSubTotal"><span>x10 subtotal: $100.00</span></div></div></div><div class="shoppingBagItemRow group" ID="shoppingBagItemRow"><div class="shoppingBagCol1">Don Cherry s Hockey Stories, Part…<br /><a href="http://www.chapters.indigo.ca/books/Don-Cherrys-Hockey-Stories-Part-Don-Cherry/9780385670036-item.html">View Details >></a></div><div class="shoppingBagCol2">Hardcover</div><div class="shoppingBagCol3"><input type="text" value="1" maxlength="2" /><div class="shoppingBagCol3Options"><a href="#" class="shoppingBagUpdateQtyWidget" productId="978038567003" catalog="books" origQuantity="1">Update Quantity</a><br /><a href="http://www.chapters.indigo.ca/Checkout/ShoppingBag.html?productid=978038567003&catalog=books&vid=&command=Delete&scSku=9780385670036&scTitle=Don+Cherry%27s+Hockey+Stories%2c+Part+2&scCatalogue=Book" class="shoppingBagRemoveWidget">Remove</a></div></div><div class="shoppingBagCol4"><span>$19.76 / <a href="http://www.chapters.indigo.ca/iRewards-program-information-page/irewardsInfo-art.html">$18.77</a></span></div></div><div class="shoppingBagItemRow group shoppingBagItemRowAlt" ID="shoppingBagItemRow"><div class="shoppingBagCol1">Lion Bookend<br /><a href="http://www.chapters.indigo.ca/gifts/Lion-Bookend/882709018445-item.html">View Details >></a></div><div class="shoppingBagCol2">Gift & Paper</div><div class="shoppingBagCol3"><input type="text" value="1" maxlength="2" /><div class="shoppingBagCol3Options"><a href="#" class="shoppingBagUpdateQtyWidget" productId="88270901844" catalog="gifts" origQuantity="1">Update Quantity</a><br /><a href="http://www.chapters.indigo.ca/Checkout/ShoppingBag.html?productid=88270901844&catalog=gifts&vid=&command=Delete&scSku=882709018445&scTitle=Lion+Bookend&scCatalogue=Gift" class="shoppingBagRemoveWidget">Remove</a></div></div><div class="shoppingBagCol4"><span>$29.99</span></div></div><div class="shoppingBagItemRow group" ID="shoppingBagItemRow"><div class="shoppingBagCol1">The Girl With The Dragon Tattoo<br /><a href="http://www.chapters.indigo.ca/books/Girl-With-Dragon-Tattoo-Stieg-Larsson/9780143170099-item.html">View Details >></a></div><div class="shoppingBagCol2">Paperback</div><div class="shoppingBagCol3"><input type="text" value="12" maxlength="2" /><div class="shoppingBagCol3Options"><a href="#" class="shoppingBagUpdateQtyWidget" productId="978014317009" catalog="books" origQuantity="12">Update Quantity</a><br /><a href="http://www.chapters.indigo.ca/Checkout/ShoppingBag.html?productid=978014317009&catalog=books&vid=&command=Delete&scSku=9780143170099&scTitle=The+Girl+With+The+Dragon+Tattoo&scCatalogue=Book" class="shoppingBagRemoveWidget">Remove</a></div></div><div class="shoppingBagCol4"><span>$7.42 / <a href="http://www.chapters.indigo.ca/iRewards-program-information-page/irewardsInfo-art.html">$6.75</a></span><div class="shoppingBagItemSubTotal"><span>x12 subtotal: $89.04</span><span><a href="http://www.chapters.indigo.ca/iRewards-program-information-page/irewardsInfo-art.html">member</a> subtotal: $81.00</span></div></div></div><div class="shoppingBagItemRow group shoppingBagItemRowAlt" ID="shoppingBagItemRow"><div class="shoppingBagCol1">Kobo Wireless eReader - Onyx<br /><a href="http://www.chapters.indigo.ca/ereading/devices/Kobo-Wireless-eReader-Onyx/817866000538-item.html">View Details >></a></div><div class="shoppingBagCol2">eReading Device</div><div class="shoppingBagCol3"><input type="text" value="1" maxlength="2" /><div class="shoppingBagCol3Options"><a href="#" class="shoppingBagUpdateQtyWidget" productId="81786600053" catalog="gifts" origQuantity="1">Update Quantity</a><br /><a href="http://www.chapters.indigo.ca/Checkout/ShoppingBag.html?productid=81786600053&catalog=gifts&vid=&command=Delete&scSku=817866000538&scTitle=Kobo+Wireless+eReader+-+Onyx&scCatalogue=eReadingDevice" class="shoppingBagRemoveWidget">Remove</a></div></div><div class="shoppingBagCol4"><span>$149.00</span></div></div> +
</div></div> +
<div class="shoppingBagBottomSection"><div class="shoppingBagMessageArea">u003ca href="/free-shipping-orders-over/promo_freeship-art.html"u003eFree Shippingu003c/au003e on orders over $25.u003cbr /u003e
Some restrictions apply.
</div> +
<a href="#" class="myCartUpdateAll">update all</a><div class="shoppingBagTotalSection"><label for="ctl00_ctl06_NewPriceText" id="ctl00_ctl06_NewPriceLabel" class="shoppingBagSubtotal">Subtotal: </label><span id="ctl00_ctl06_NewPriceText" class="shoppingBagSubtotal">$485.56</span><br /> +
<label for="ctl00_ctl06_myCartMemberPriceText" id="ctl00_ctl06_myCartMemberPriceLabel" class="shoppingBagMemberSubtotal"><a href="http://www.chapters.indigo.ca/iRewards-program-information-page/irewardsInfo-art.html">Member</a> Subtotal: </label><span id="ctl00_ctl06_myCartMemberPriceText" class="shoppingBagMemberSubtotal">$474.29</span><br /><div class="shoppingBagButtons group"><a id="ctl00_ctl06_myCartBtnCheckoutBottom" class="addToCart" href="http://www.chapters.indigo.ca/Checkout/ShoppingBag.html?Lang=en-CA&ReferringSection=home&Redirect=">Checkout</a></div></div> +
</div><!--[if lte IE 6.5]><iframe class="dialogIE6Fix" src="javascript:false;"></iframe><![endif]--></div> ,
"itemCount": 30 ,
"MCSCProfile":
}
});
我如何从产出中获取“popUp/2006/2/strong”值? 我尝试了data.jsonresult[0].popUp/2006/2/strong>,但并不奏效。 我在此面临的问题是什么?
Note : my request domain is different this jsonp call to domain is external one