Ich versuche, den Code unten auszuführen, aber nichts passiert.Webservice mit jQuery konsumieren
Ich erhalte keine Fehlermeldungen in Firefox/Chrome in Entwickleroptionen.
Irgendeine Idee, was ich falsch mache?
$(document).ready(function() {
jQuery.support.cors = true;
var AltCoin = "ripple";
//var api_url = "https://api.coinmarketcap.com/v1/ticker/" + AltCoin;
var api_url = "https://api.coinmarketcap.com/v1/ticker/";
$.ajax({
method: "GET",
dataType: "jsonp",
url: api_url,
data: AltCoin,
success: function(data) {
try {
$('#coin_value').html(data);
}
catch (error) {
alert('error found');
}
}
});
});
<article class="article">
<h1>Ripple</h1>
<p id="coin_value">test</p>
<p></p>
<p><strong></strong></p>
</article>
Das Skript ist sehr einfach.
Wenn Sie einen 'error' Handler hinzufügen, können Sie das Problem sehen: https://jsfiddle.net/whw29h0g/ –
Laut Ihrem Code sah ich Api Returns Einige Daten in Json Format Sir [https://api.coinmarketcap.com/v1/ticker/ripple/](https://api.coinmarketcap.com/v1/ticker/ripple/) –