0
Friends、私はdjangoでajax jsonの応答を取得しようとしています。jsonの構文解析では、django jqueryのオブジェクトが1つだけ返されます。
コンソールログにはすべてのjsonオブジェクトが表示されますが、jsonを解析してhtmlの除算にフィールドを追加している間は、同じことは成り立ちません。 1つのオブジェクトのフィールドだけが表示されます。私は私が間違っているつもりだところを見つけ出すことはできません
$("#all_questions").on("click",
function(event){
all_questions();
}
);
function all_questions()
{
console.log("all_questions() working..");
$.ajax({
url : "/questions",
type : "GET", // http method
data : { },
success : function(json) {
console.log(json); // log the returned json to the console
$("#content").empty();
data = JSON.parse(json);
$.each(data, function(idx, obj) {
$('#content').html(obj.fields.title);
});
}
,
error : function(xhr,errmsg,err) {
console.log(xhr.status + ": " + xhr.responseText);
}
});
}
を次のように
私のjavascriptのです。
patitoに感謝します。 – amankarn