FANDOM


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


Functions

$.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
  • onErrorCallback - function to call when an error occures

$.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

$.nirvana.postJson

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

Simplified version of sendRequest used to send JSON encoded data using POST 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

$.nirvana.getUrl

$.nirvana.getUrl = function(data) {}

This method returns an url which could be used in $.ajax()

Parameters:

  • data - object of parameters to be passed to the controller
    • controller - name of the controller to get the data from
    • method - name of the controller's method to use

Controller & Methods

Controller Method Request type Returns Params
WallNotificationsExternal getUpdateCounts GET  Amount of unread message in all wikis none
WallNotificationsExternal getUpdateWiki GET Amount of unread message for a specific wiki
  • number wikiId
  • boolean isCrossWiki
UserProfilePage renderUserIdentityBox GET Gets user information from MastHead
  • string title ("Username: " + wgUserName)
WallExternal postNewMessage  POST  Sends a message to messageWall
  • string body (message),
  • string messagetitle: subject
  • string pagetitle (username)
  • number pagenamespace (default: 1200)
  • string convertToFormat (default: 'wikitext')
  • string token (editToken)
See Documentation

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.