0

URLのレンダリングHTMLのファイルコンテンツを読み込もうとしています

ここで私が使用しているコードは、常にエラーセクションに入っています。

  $.ajax({
            type: 'POST',
            url: 'http://www.withholding32.com/api/wh32calc.php?userid=nick&fpp=12&ffs=Single&fa=0&fgp=6000&figp=0&fiytd=0&st=6&stp=6000&ss=Single&sa=0&sad=0&stca=0',
            dataType: 'html',
            success: function(data) {
                alert('success');
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert('error');
            }
        });

しかし、ブラウザで同じURLを直接実行すると、htmlが表示されます。

ここにURLがあります

4

4 に答える 4

1

以下のコードを試してください。

   $('document').ready(function() {

      $.getJSON('http://anyorigin.com/get?url=' + 
      encodeURIComponent('http://www.withholding32.com/api/wh32calc.php?userid=nick&fpp=12&ffs=Single&fa=0&fgp=6000&figp=0&fiytd=0&st=6&stp=6000&ss=Single&sa=0&sad=0&stca=0') + '&callback=?',

      function(data){
         $("#result").html(data.contents);

       });

});

参照: http: //jsfiddle.net/R7EPt/275/

于 2013-10-31T11:44:38.623 に答える