Difference between revisions of "AJAX"

From Organic Design wiki
(add jQuery, rm from glossary)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
Ajax is Asyncronous Javascript And XML. The main concept is the ''XmlHttpRequest'' (XHR) object which is a standard way of making HTTP requests from within the JavaScript runtime environment.
 
Ajax is Asyncronous Javascript And XML. The main concept is the ''XmlHttpRequest'' (XHR) object which is a standard way of making HTTP requests from within the JavaScript runtime environment.
 
== MediaWiki Ajax ==
 
Currently our Ajax extensions ([[Extension:SimpleForms|SimpleForms]] and [[Extension:Livelets|Livelets]]) use the [http://mootools.net MooTools] JavaScript framework. The most commonly used ajax process is to post a form to the server and have the response directed to the ''innerHTML'' property of an element having a particular ''id'' attribute. The ''mootools'' syntax for achieving this functionality is:
 
<js>
 
$('form-id').send({update:$('target-id')})
 
</js>
 
where ''form-id'' specifies the ''id'' attribute of the form whose content we want to send to the server, and ''target-id'' is the ''id'' attribute of the element the servers response should be appear within (usually a ''div'' element).
 
 
I'd like to have a simple code snippet for achieving that same basic ajax requirement with the native MediaWiki components rather than depending on a third-party framework.
 
 
It says in [[MW:Manual:Parameters to index.php]] regarding ''action=ajax'', that a PHP function in ''AjaxFunctions.php'' will be executed. That module contains ''wfSajaxSearch'' (search for articles of title similar to a search term) and ''wfAjaxWatch'' (watch/unwatch a page). Note that ''$wgUseAjax'' must be set to true and the only callable functions are those in the array ''$wgAjaxExportList'' (which is also modified by the variables ''$wgAjaxSearch'' and ''$wgAjaxWatch''). In addition to ''action=ajax'', there is ''rs'' (the function name, e.g. ''rs=wfSajaxSearch''), ''rsargs[]'' (an array of arguments to the function (e.g., rsargs[]=abcd passes the abcd string to the function). There is a JavaScript function for calling this action in ''ajax.js''.
 
  
 
== Popular Ajax Frameworks ==
 
== Popular Ajax Frameworks ==
*http://mootools.net
+
*[http://jquery.com jQuery]
*http://www.prototypejs.org
+
*[http://mootools.net MooTools]
*http://wiki.script.aculo.us/scriptaculous/show/Demos
+
*[http://www.prototypejs.org PrototypeJS]
 +
*[http://wiki.script.aculo.us/scriptaculous/show/Demos Scriptaculous]
  
 
== See also ==
 
== See also ==
 
*[[w:Ajax (programming)|Wikipedia:Ajax]]
 
*[[w:Ajax (programming)|Wikipedia:Ajax]]
 
*[http://www.w3schools.com/ajax/default.asp W3C Ajax tutorial]
 
*[http://www.w3schools.com/ajax/default.asp W3C Ajax tutorial]
[[Category:glossary]]
+
*[[5 October 2007]] ''- news item about OrganicDesign changing to MediaWiki native ajax functionality''
 +
*[[Talk:{{PAGENAME}}]] ''- original conversation about mootools independence''
 +
[[Category:Software]]

Latest revision as of 07:17, 9 July 2011

Ajax is Asyncronous Javascript And XML. The main concept is the XmlHttpRequest (XHR) object which is a standard way of making HTTP requests from within the JavaScript runtime environment.

Popular Ajax Frameworks

See also