Fabriq Framework Docs

The fabriq.js file contains some base JavaScript functionality for helping to rapidly develop your Fabriq based web applications and websites.

Fabriq.ajax_path()

Parameters

This function takes a variable number of parameters.

Description

This function takes a variable number of parameters with which to make a path for AJAX calls. Making use of this method is preferable over statically writing the path in case you are building a web application or website that has the possibility of being distributed on multiple servers, some of which have clean URLs enabled and some of which have clean URLs disabled.

Example(s)

$.ajax({
  type: 'POST',
  url: Fabriq.ajax_path('myblog', 'read', 1234),
  dataType: 'json',
  success: function(data, status) {
    // do something with the returned data
  }
});

Return type: string

Fabriq.base_path()

Description

Returns the application's base path.

Example(s)

$('form:first').attr('action', Fabriq.base_path() + '/myblog/create');

Return type: string

Fabriq.build_path()

Parameters

This function takes a variable number of arguments.

Description

This function takes a variable number of arguments to build a path.

Example(s)

document.write('This page can be found at: ' + Fabriq.build_path('myblog', 'read', 1234));

Return type: string

Fabriq.clean_urls()

Description

Returns whether or not the application uses clean URLs.

Example(s)

if (Fabriq.clean_urls()) {
  // do something if clean URLs are being used
}

Return type: boolean