Skip to main content

FW.Lazy.Fetch()

This function calls jQuery's ajax() function behind the scenes and provides some handy extra functionality, like replacing a DOM element and greying out the target element while the AJAX call is pending.

FW.Lazy.Fetch(uri, el, options)

uri = '?cmd=portal_method'
el = $('#target_element');
options = {
  method: 'GET',
  data: {
    // Object or query string to send to the server
  },
  silent: false, //If set to true, suppresses the loading message
  replace: true, //If set to false, appends fetched content to the target element instead of replacing it
  callback: function () {
    // Do stuff
    // Don't think any data is passed to the callback
  },
  error: function () {
    // Do stuff
  }
}