Guest User

Untitled

a guest
May 27th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. YUI({
  2.  
  3. // we must tell the autoloader to get code from our server as we are using https
  4. base: 'templates/dealdirect/js/yui_3.0.0/yui/build/', timeout: 10000
  5.  
  6. }).use('event', 'node', 'io-base', 'node-event-simulate', function(Y) {
  7.  
  8. Y.on('domready', clickListener);
  9.  
  10. function clickListener() {
  11. // simulate an initial selection
  12. Y.one("#fixed").simulate("click");
  13. //Y.on("click", alert("it fired"), "#mortgage_rates_nav li");
  14. // detect when a navigation link is clicked
  15. Y.on("click", requestRateTable, "#mortgage_rates_nav li");
  16. }
  17.  
  18. function requestRateTable(e) {
  19. //e.currentTarget is a Node reference to the #mortgage_rates_nav li
  20. var selectedLi = e.currentTarget.get('id');
  21. var uri = "index.php?option=com_dealdirect&view=rates_table&layout=send_table&format=raw&loan_type=" + selectedLi;
  22.  
  23. // Subscribe to event "io:complete", and pass an array
  24. // as an argument to the event handler "complete", since
  25. // "complete" is global. At this point in the transaction
  26. // lifecycle, success or failure is not yet known.
  27. Y.on('io:complete', updateHTML, Y);
  28.  
  29. // Make an HTTP request to 'get.php'.
  30. // NOTE: This transaction does not use a configuration object.
  31. var request = Y.io(uri);
  32.  
  33. }
  34.  
  35. // Define a function to handle the response data.
  36. function updateHTML(id, o, args) {
  37. var id = id; // Transaction ID.
  38. var html = o.responseText; // Response data.
  39. // get the node for the div holding the table
  40. var mortgage_rates = Y.one('#mortgage_rates_data');
  41. mortgage_rates.set('innerHTML', html);
  42. };
  43.  
  44. });
Add Comment
Please, Sign In to add comment