Using Ajax Extension
SUI.Ext.Ajax is the core Object for XHR Request, which allow us to have more option compare to using .load(). To make it easy to code, you can also use SUI.Ajax.
This example shows how to use Ajax XHR request with Savvy.UI via SUI.Ext.Ajax Class.
You can also view the code from ajax-using-extension.js.
// Wait for document to be ready SUI(document).ready(function() { SUI("#ajax-ext").clicks(function() { SUI("#hello-ext").html("Loading..."); // use SUI.Ajax to load new content, return JSON new SUI.Ajax({ method: "GET", data: {option: 2}, uri: "http://savvyui.com/deploy/example/ajax.php" }); }); });
<div> <input type="button" id="ajax-ext" value="Send XHR Request" /> </div> <p id="hello-ext"></p>
This example requires the following namespace:
- SUI.Ext.Ajax
- SUI.onDOMReady
