Ajax Using .load()
.load() simplify XHR request for Savvy.UI. The function only support GET method for all XHR request, for more option refer to SUI.Ext.Ajax.
This example shows how to use Ajax XHR request with Savvy.UI via .load() function.
You can also view the code from ajax-using-load.js.
// Wait for document to be ready SUI(document).ready(function() { // Enable debugger to prompt error. SUI.fn.debug = true; // Initialize onClick event handler for #ajax1 button SUI("#ajax-load").clicks(function() { // update #hello1 with content from "ajax.php?option=1" SUI("#hello-load").html("Loading...").load("http://savvyui.com/example/ajax.php?option=1"); }); });
<div> <input type="button" id="ajax-load" value="Send XHR Request" /> </div> <p id="hello-load"></p>
This example requires the following namespace:
- SUI.Ext.Elements
- SUI.Ext.Ajax
- SUI.onDOMReady
