2015-05-14 185 views
2

我收到錯誤信息:「拒絕從'URL'執行腳本,因爲它的MIME類型('text/html')不可執行,並且啓用嚴格的MIME類型檢查。「拒絕從'URL'執行腳本,因爲它的MIME類型('text/html')不可執行,並且啓用嚴格的MIME類型檢查

我的代碼如下。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head> 
    <title>Untitled Page</title> 
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script> 
    <script type="text/javascript"> 
     $(document).ready(function() { 
      $.ajax({ 
       url: "https://www.google.com/finance/converter?a=1&from=INR&to=USD&jsoncallback=?", 
       type: "GET", 
       contentType: "application/javascript",     
       cache: false, 
       dataType: "jsonp", 
       success : function(response){ 
         alert("Hi"); 
       } 
      });    
    }); 

    </script> 
</head> 
<body> 
</body> 
</html> 

回答

0

您提供的網址(https://www.google.com/finance/converter?a=1&from=INR&to=USD&jsoncallback=?)似乎指向一個HTML頁面。這個錯誤非常明顯。我聽說谷歌貨幣轉換器已不在線。請嘗試其他一些API可能會像JsonRates

相關問題