1
Ich kann keine internen Elemente der JSON-Daten abrufen. Here's der Link für die JSON-Daten.wie json daten von url holen?
Hier ist mein Code:
$(document).ready(function() {
//after button is clicked we download the data
$('.button').click(function(){
//start ajax request
$.ajax({
url: "http://www.miamia.co.in/dummy/?json=get_recent_posts",
//force to handle it as text
dataType: "text",
success: function(data) {
//data downloaded so we call parseJSON function
//and pass downloaded data
var json = $.parseJSON(data);
//now json variable contains data in json format
//let's display a few items
$('#results').html('Pages:'+ json.pages + '<br />postid: '+json.posts.id);//here I am not able to get the id
}
});
});
});
Haben Sie versucht, einen Fehler-Handler hinzugefügt, welche AJAX-Fehler sehen auftritt? Ist Knopf Teil eines Formulars? Tritt ein Klick-Ereignis auf? Nicht viele Informationen zur Fehlerbehebung. Sehen Sie [ask] – charlietfl
'dataType:" json "' versuchen Sie, dies in Ihrem Ajax zu verwenden – Ramkee
y kann Sie den dataType zu Json anstelle von Text machen. Und hast du versucht, json in der Konsole zu drucken? – sarath