StickyWin.Ajax

docs

All of the StickyWin classes have a .Ajax version that will allow you to retrieve their content from the server. The expected response from the server is HTML, but really it can be anything.

All StickyWin*.Ajax classes have the following options in addition to the options in their respective non-ajax versions:

url
(string) the default url for the instance to hit for its content. See update
requestOptions
(object) options passed on in the ajax Request; defaults to {method:'get'}.
wrapWithUi
(boolean) if true, wraps the response in StickyWin.ui.
caption
(string) if wrapping with StickyWin.ui, this caption will be used; defaults to empty string.
uiOptions
(object) if wrapping with StickyWin.ui, these options will be passed along as the options to StickyWin.ui; defaults to an empty object.
handleResponse
(function) handles the response from the server. Default will wrap the response html with StickyWin.ui if that option is enabled (which it isn't by default), then calls StickyWin.setContent and then StickyWin.show. This method is meant to be replaced with custom handlers if you want a different behavior (which is why it's an option).

Examples:

This one will use stickyWinHTML to wrap the response.

new StickyWin.Ajax({
  url: '/wiki/stickyWinAjaxExample.html',
  wrapWithUi: true,
  caption: 'StickyWin.Ajax test'
}).update();
execute this code

This one will just display the response:

new StickyWin.Ajax({
  url: '/wiki/stickyWinAjaxExample.html'
}).update();
execute this code

This one will handle the results itself, alerting them:

new StickyWin.Ajax({
  url: '/wiki/stickyWinAjaxExample.html',
  handleResponse: function(response){
    alert(response);
  }
}).update();
execute this code