Using jQuery with Other Libraries
- Overriding the $-function
- Including jQuery before Other Libraries
- Referencing Magic – Shortcuts for jQuery
var J = jQuery.noConflict();
function init(){
J(“div#sshow”).slideView();
}
J(window).bind(“load”, init );
var J = jQuery.noConflict();
function init(){
J(“div#sshow”).slideView();
}
J(window).bind(“load”, init );
JavaScripts create XMLHttpRequest() object first.
req = new XMLHttpRequest();
once we create XMLHttpRequest() object, then we can request xml data
req.open(“GET”, url);
req.send(null);
then check onreadystatechange state
req.onreadystatechange = processReqChange;
it has 5 states (0-4)and 4 means completed retrieving data
function processReqChange() {
// only if req shows "complete"
if (req.readyState == 4) {
// only if "OK"
if (req.status == 200) {
// ...processing statements go here...
response = req.responseXML;
if (response) {
// do something with XML contents
} else {
// no XML contents
}
} else {
alert("There was a problem retrieving the XML data:n" +
req.statusText);
}
}
}
Asynchronous JavaScript and XML, I can explain this with just one picture.
This picture show us that the browser doen’t connect to a websever to get html pages any more. for example, if you open gmail.com, then you will get bunch of xml document instead of html.
with those xml document, the JavaScript will generate proper html pages.
it’s pretty simple concept, huh?
Wikipedia says
Simple tutorial
Ajax blog
Java BluePrints Solutions Catalog
Technical article