私は最近問題に直面しています。ajax投稿を介してOpencartのショッピングカートにアイテムを追加し、結果をdivに追加するスクリプトがあります。ただし、設定された応答とは異なる応答が得られているようです
"Success: You have added <a href="%s">%s</a> to your <a href="%s">shopping cart</a>!"
これは、div で取得している応答です。
{"success":"Success: You have added
<a href="\"http:\/\/mystore.org\/store\/index.php?route=product\/product&product_id=50\"">
Apple<\/a> to your</a><a href="\"http:\/\/mystore.org\/store\/index.php?route=checkout\/cart\"">
shopping cart<\/a>!","total":"3 item(s) - $20.99"}
</a>
これは私のスクリプトです:
$(document).ready(function(){
$("#addform").submit(function() {
$.post($("#addform").attr("action"), $("#addform").serialize(), function(data){
$("#result").empty().slideDown("slow").append(data);
});
return false;
});
});
初心者なので、できれば詳しく教えてください。
どうもありがとうございました