Non capisco cosa sia andato storto durante l'analisi di file:SyntaxError: JSON Errore di analisi: imprevisto identificatore "oggetto" (funzione anonima)
{ "t": -9.30, "p": 728.11, "h": 87.10 }
codice javascript:
<script type="text/javascript">
function check() {
$.get("http://....file.json", function(response, status, xhr) {
if (status == "success") {
var json = JSON.parse(response);
$("#temp").html(json.t + "°");
$("#pressure").html(json.p + " mm hg");
}
if (status == "error") {
$("#temp").html("error");
}
});
}
ricevo errore:
SyntaxError: JSON Parse error: Unexpected identifier "object"
console.log (risposta); ? –
non è necessario analizzare – anand4tech
Grazie a tutti, il problema è stato risolto – aspire89