Guten Morgen,Erste Json Daten von Link
Ich habe diesen einfachen Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>READ JSON Example (AJAX)</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.ajax({
type: "GET",
url: "http://phonegappro.esy.es/test/json.php",
crossDomain: true,
cache: false,
success: function (result) {
var result = $.parseJSON(result);
$.each(result, function (i, field) {
$("#output").append("Title: " + field.title + " duration: " + field.duration + " Price:" + field.price + "<br/>");
});
}
});
});
</script>
</head>
<body>
<div id="output">
</div>
</body>
</html>
versucht, Daten von json zu bekommen. Ich habe zwei Json Links.
Das zweite Werk, aber die erste, die ich brauche, nicht funktioniert. Und sie sind fast gleich. Was scheint ein Problem für den ersten zu sein? vielleicht wegen seiner größeren Datei?
Danke!
'fast' passt hier nicht. Das Antwortformat sollte "selbe" sein. –
Versuchen Sie, contentType als 'application/json' und dataType als 'json' 'zu verwenden. – patilprashant6792
[Gleiche Ursprungsrichtlinie] (https://developer.mozilla.org/en-US/docs/Web/ Sicherheit/Gleich-Ursprung_policy). Der zweite Server unterstützt [CORS] (https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) ('Access-Control-Allow-Origin: *'). – Andreas