Created
May 31, 2010 21:27
-
-
Save nickweavers/420294 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YUI({ | |
// we must tell the autoloader to get code from our server as we are using https | |
base: 'templates/dealdirect/js/yui_3.0.0/yui/build/', timeout: 10000 | |
}).use('event', 'node', 'io-base', 'node-event-simulate', function(Y) { | |
Y.on('domready', clickListener); | |
function clickListener() { | |
// simulate an initial selection | |
Y.one("#fixed").simulate("click"); | |
//Y.on("click", alert("it fired"), "#mortgage_rates_nav li"); | |
// detect when a navigation link is clicked | |
Y.on("click", requestRateTable, "#mortgage_rates_nav li"); | |
} | |
function requestRateTable(e) { | |
//e.currentTarget is a Node reference to the #mortgage_rates_nav li | |
var selectedLi = e.currentTarget.get('id'); | |
var uri = "index.php?option=com_dealdirect&view=rates_table&layout=send_table&format=raw&loan_type=" + selectedLi; | |
// Subscribe to event "io:complete", and pass an array | |
// as an argument to the event handler "complete", since | |
// "complete" is global. At this point in the transaction | |
// lifecycle, success or failure is not yet known. | |
Y.on('io:complete', updateHTML, Y); | |
// Make an HTTP request to 'get.php'. | |
// NOTE: This transaction does not use a configuration object. | |
var request = Y.io(uri); | |
} | |
// Define a function to handle the response data. | |
function updateHTML(id, o, args) { | |
var id = id; // Transaction ID. | |
var html = o.responseText; // Response data. | |
// get the node for the div holding the table | |
var mortgage_rates = Y.one('#mortgage_rates_data'); | |
mortgage_rates.set('innerHTML', html); | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment