1. 程式人生 > >JSON常用寫法

JSON常用寫法

get寫法

function f1(){
            //ajax去伺服器端請求json資訊回來
            var xhr = new XMLHttpRequest();
            xhr.onreadystatechange = function(){
                if(xhr.readyState==4){
                    alert(xhr.responseText)
                }
            }
            xhr.open('get','./04.php');
            xhr.send(null);
        }