0

volusion ストアを使用してウェブサイトを作成しています。製品ページに製品を表示したいので、コードをカスタマイズしています。ボリュージョンAPI、つまり標準エクスポートを作成しました.AjaxでそのAPIを使用して、その製品の詳細をページにフェッチするだけです。どうすればそれを達成できますか?https:///dataport/dl/Generic/Products.xml のように .xml 拡張子を持つ API を作成した最初のタイプでは、データが表示され、そのデータを取得することもできますが、2 番目のタイプの URL では http などです。 :///net/WebService.aspx?Login=&EncryptedPassword=&EDI_Name=Generic\Products&SELECT_Columns=p.ProductID,p.ProductName,pe.Photo_AltText,pe.Photo_SubText,pe.PhotoURL_Large,pe.PhotoURL_Small,pe.Price_SubText,pe. Price_SubText_Short,pe.ProductPrice,pe.ProductPrice_Name ajax を使用してそのデータを取得できません。

以下にコードを共有しましたので、確認してこの問題の解決にご協力ください。

<script>
    $(document).ready(function(){

$.ajax({
    type: "POST",
    url: "http://<domainname.com>/net/WebService.aspx?Login=<username>&EncryptedPassword=<password>&EDI_Name=Generic\Products&SELECT_Columns=p.ProductID,p.ProductName,pe.Photo_AltText,pe.Photo_SubText,pe.PhotoURL_Large,pe.PhotoURL_Small,pe.Price_SubText,pe.Price_SubText_Short,pe.ProductPrice,pe.ProductPrice_Name",
    dataType: "xml",
    success: function(result) {
        alert(result);
        parseXml(data);
    }
});

});
function parseXml(data) {
    var id;
    var code;
    var name; 
    $(data).find('Products').each(function( ){ 
        $(this).find("ProductCode").each(function() {
            code = $(this).text();
        });
        $(this).find("ProductID").each(function(){
            id = $(this).text();
        });
        $(this).find("ProductName").each(function(){
            name = $(this).text();
        });
        $('.col-md-6').append(code +"<br />"+ id +"<br />"+ name);
    });
}

</script>
<div id='getresult'>
    Api code will refelect here
    <div class="container">
        <div class="row">
            <div class="col-md-6"></div>
        </div>
    </div>
</div>
4

1 に答える 1