MediaWiki talk:Gadget-vsk-hosts.js


 * The problem: An admin at a remote server (which has XML data that I wish to query from a wiki page) is asking me not to use AJAX but rather to use PHP (or any other server-side language) to parse "publicScript.php" and then send the answer to the browser client. They will not support JSONP for reasons unknown. Adding to the bizarre bureaucracy is their requirement for authentication using what amounts to a shared username/password pair.

At wikia.com I only know of JavaScript and CSS support.
 * Is it safe to assume that any kind of PHP (or ASP) scripting is not supported?


 * Possible explanation: I have read at and  that cross domain calls are not supported by XmlHttpRequest. Since XmlHttpRequest is also at the core of jQuery.ajax I assume the same restriction applies. This message seems to be reinforced by Same_origin_policy and also . On the other hand, when a JSON call is used (see MediaWiki:Gadget-tunnglelivelist.js there is no cross-domain restriction.

-- najevi 08:50, December 14, 2009 (UTC)


 * Questions for an expert:
 * 1) Is there an alternative to $.ajax in this situation?
 * 2) * remote server requires authentication using user/password pair
 * 3) * data to be returned is XML (remote server does not/will not support JSON)
 * 4) Is the syntax I am using for $.ajax correct?
 * 5) * callback functions for error and success - are they supposed to show the number of parameters passed or just use empty parentheses?
 * 6) ** obviously a callback function's definition must show the number of parameters that are expected
 * 7) * dataType explicitly specifies XML but how can I check that the correct mime-type is being used in the returned page? Should there be an ASCII header?
 * 8) * Does the simple error function (echoXHR) correctly using it's parameters? (I am always confused by the this object)
 * 9) Does my use of $.ajaxSetup (now commented out) appear to be correct?
 * 10) * Is there any way to hide or camouflage the user/password pair from casual prying eyes?
 * 11) Is there any environment where I can test jQuery's AJAX functions independently of Wikia?

Are these five options (each one specifies a callback function) related to the XmlHttpRequest.readyState property?
 * About call backs:
 * 1) xhr e.g. state 0
 * 2) beforeSend e.g. state 1
 * 3) filterData
 * 4) success e.g. state 4 but with .status = 200
 * 5) error e.g. state 4 but with .status = 401|403|404
 * 6) complete

Possible values for the readyState property: State	Description 0	The request is not initialized 1	The request has been set up 2	The request has been sent 3	The request is in process 4	The request is complete

-- najevi 21:44, December 13, 2009 (UTC)

Properties and methods for XmlHttpRequest

 * http://www.dynamicajax.com/fr/XmlHttpRequest_Properties-271_272_302.html
 * onreadystatechange
 * readystate
 * responseText
 * responseXML
 * status
 * statusText
 * http://www.dynamicajax.com/fr/XmlHttpRequest_Methods-271_272_301.html
 * abort
 * getAllResponseHeaders
 * getResponseHeader(header)
 * open(method, url, data-type , username, password) see also: XMLHttpRequest
 * send(body)
 * setRequestHeader(header, value)

-- najevi 06:55, December 14, 2009 (UTC)