FileMaker AJAX
JavaScript XSLT


FMAjax is a javascript library and accompanying FileMaker module which includes functions to facilitate communication with a web viewer without reloading the page. It helps you call FileMaker scripts from a web viewer application and return data to the web viewer. The two important parts of accomplishing this are using the onhashchange javascript event to get data to the web viewer via the url and using jsonp to load files into the web viewer asynchronously. These solutions work across Mac, Windows, and iOS, hosted and local files. FileMaker 13.0v2 is required.

A chronology of events might help explain how it works

  1. On initialization, web code files are exported to the temporary directory.
  2. These files are then loaded into their corresponding web viewers.
  3. The fmajax.js javascript library is also exported and referenced in the pages loaded in the web viewers.
  4. The user interacts with the web viewer and does something that requires data to be retrieved from FileMaker.
  5. An fmp:// url is triggered in the web viewer which includes any needed variables and parameters.
  6. This url opens a FileMaker script which gathers the data or takes any needed actions.
  7. The data is sent to an fmajax FileMaker script.
  8. The script exports the data to a file or to the hash of the web viewer's source url.
  9. If the data was exported to a file, then the hash of the web viewer's source url is updated.
  10. If the data was exported to a file, the web viewer loads the files as a javascript file and processed the data.
  11. If the data was sent to the hash, then it is processed directly by the web viewer.

Data can also be pushed from FileMaker to a web viewer by starting on step 7

There are three tables for the FMAjax module

  1. web_viewer_code - stores code for web files
  2. web_viewer_insances - stores data relating to each web viewer
  3. FMAjax - base table with globals and user preferences

See the FMAjax.fmp12 file for installation instructions