Fandom

Wikia Developers Wiki

Nirvana/JavaScript

< Nirvana

847pages on
this wiki
Add New Page
Talk0 Share

We have a $.nirvana object (defined in jquery.wikia.js) containing helper functions to get data from controllers from JavaScript layer of the application.


$.nirvana.sendRequest

$.nirvana.sendRequest = function(attr) {}

This method is a helper for making requests to wikia.php Nirvana entry point.

attr is an object which must contain following fields:

  • controller - name of the controller to get the data from
  • method - name of the controller's method to use

Optional fields:

  • format - either json or html (default: json)
  • type - either get or post (default: post)
  • data - object of parameters to be passed to the controller
  • callback - function to call when data is fetched from the controller

$.nirvana.getJson

$.nirvana.getJson = function(controller, method, data, callback) {}

Simplified version of sendRequest used to fetch JSON encoded data using GET request.

Parameters:

  • controller - name of the controller to get the data from
  • method - name of the controller's method to use
  • data (optional) - object of parameters to be passed to the controller
  • callback - function to call when data is fetched from the controller

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.