- [可參考資源](https://www.runoob.com/jquery/ajax-ajax.html) ### 資料夾目錄:  ### 語法: - 設定一個按鈕,當我 click 時,則可以透過 JavaScript 獲取 JSON 資料。 ```html <h1>捕獲JSON練習</h1> <button class="getData">get data</button> ``` - **JavaScript 代碼**: ```js const getData = document.querySelector(".getData"); getData.addEventListener( "click", (e) => { // 語法在這: 'test.json' -> 為你的目標路徑資料 $.getJSON("test.json", function (json) { console.log(json); }); }, false ); // console output: ``` 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up