使用JavaScript将数据json显示到网页中

使用JavaScript将数据json显示到网页中,javascript,php,html,dom,Javascript,Php,Html,Dom,我发现问题将显示结果jSon到一个网页在运行时数据是空的或空白的网页,如果有人可以帮助我 这是我的变量声明 var xmlhttp=new XMLHttpRequest(); 变量url=”http://adisapu10022.besaba.com/smsVerify/json.php"; xmlhttp.onreadystatechange=函数(){ if(xmlhttp.readyState==4&&xmlhttp.status==200){ myFunction(xmlhttp.re

我发现问题将显示结果jSon到一个网页在运行时数据是空的或空白的网页,如果有人可以帮助我

这是我的变量声明

var xmlhttp=new XMLHttpRequest();
变量url=”http://adisapu10022.besaba.com/smsVerify/json.php";
xmlhttp.onreadystatechange=函数(){
if(xmlhttp.readyState==4&&xmlhttp.status==200){
myFunction(xmlhttp.responseText);
}
}
open(“GET”,url,true);

xmlhttp.send()我发现您的json字符串无效。查看

正确的格式是


好的,谢谢,我没那么小心。现在的问题是如何显示从url拍摄的图片?我的客户估计是您必须在
img
标记(如
)中使用
arr[i].Foto
。您能向我展示完整的json字符串以便我提供帮助吗?
"Komoditas":"Sepatu Nike",{"Harga":"900 Ribu /kg"
"Komoditas":"Sepatu Nike","Harga":"900 Ribu /kg"