Try It Editor
Tip: Press
Ctrl/⌘ + Enter
to Run
▶ Run
Reset
Copy
Download
Code
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>AJAX Example</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> </head> <body> <button id="load">Load Data</button> <div id="result"></div> <script> $("#load").click(function(){ // Using a sample JSON placeholder API $.getJSON("https://jsonplaceholder.typicode.com/users/1", function(data){ $("#result").text("Name: " + data.name + ", Email: " + data.email); }); }); </script> </body> </html>
Output