Wikipedia:WikiProject User scripts/Guide/Ajax: Difference between revisions

Content deleted Content added
Preview: typo
Alex Smotrov (talk | contribs)
rewording XMLHttpRequest
Line 1:
<!--Scripts with [[Ajax (programming)|Ajax]] usually do something without leaving the page.-->
 
==[[XMLHttpRequest]]==
Usual approach for creating cross-browser [[XMLHttpRequest]] object is<br />
To create the object you could use cross-browser example from the article but it's easier to utilize built-in [{{SERVER}}/skins-1.5/common/ajax.js ajax.js] functionality:
<code>if (window.XMLHttpRequest) ... else if (window.ActiveXObject) ...</code>.
 
However, built-in [{{SERVER}}/skins-1.5/common/ajax.js ajax.js] already has this code, so userscripts can simply use
<source lang=javascript>
xmlhttp = sajax_init_object();
</source>
 
 
==Data sources==