Method 1 (Using getJSON)
This method loads JSON encoded data from server using GET HTTP request. Using JSON data structure this example simply sets the content of specified elements with JSON values.
Method 2 (Using jQuery Ajax)
This is similar to method above, but here we can specify additional options before sending ajax requests. Click here to see all the options you can set.
PHP process.php File
This PHP file generates JSON encoded data from random strings provided in array.
JSON data below is similar to what our process.php file will generate.
Full Code (Using both Methods)
Our complete HTML code, as you can see both methods are wrapped in functions, and are called in button click events.