私はjsonのためにdocument.write()
を使用します。アヤックスの外でdocument.write(JSON.stringify({name:'jason',surname:'etc'}));
で作業しますが、.done()
では動作しません。 dataType:'json'
を削除しようとしましたが、動作しません。JSON.stringify in jquery ajax
$.ajax({
url: "http://api.wunderground.com/api/24b969202160514e/geolookup/conditions/q/Turkey/zmw:00000.58.17352.json",
dataType:'json'
})
.done(function(data) {
console.log("success",data);
document.write(JSON.stringify(data));
//document.write(data);
})
.fail(function(data) {
console.log("error",data);
})
.always(function() {
console.log("complete");
});
'done' – prasanth
https://www.w3schools.com/jsref/met_doc_write.asp私はおそらく文書準備した後、あなたカント利用のdocument.writeを考える代わりに、' SUCCESS'を試してみてください。 jqueryを使用して、ページの一部の要素にコンテンツを変更または追加することができます。 – Surely
@prasanth私は試してみましたが動作しません。実際にはコードは仕事ですが、私はページに生のjsonを書きたいと思います。 html> bodyで記述します。それは成功の外に生のjsonを書くか、または機能を終了しました。どのようにページに生のjsonを書くか。 html> bodyなし。 – bukalemun