ajax2
<script type="text/javascript">
// var value = 0;
// createRequest();
// function createRequest(){
// if(XMLHttpRequest){
// var xhr = new XMLHttpRequest();
// }else{
// var xhr = new ActiveXObject("Microsoft.XMLHTTP");
// }
// xhr.open("get","json.txt",true);
// xhr.send(null);
// xhr.onload = function(){
// console.log(JSON.parse(xhr.responseText).name);//把获取的string变成json
//// console.log(eval("("+xhr.responseText+")").name);//吧获取的转化为数组对象
// }
// }
// console.log(value);
// var oJson = {
// name:"ketty",
// age:"12",
// job:"star"
// }
// alert(oJson.name)
</script>
json.txt
{
"name":"++value",
"age":"12",
"job":"star"
}

浙公网安备 33010602011771号