On Tue, 06 Jun 2006 14:27:59 -0700, Chris Moltisanti wrote:
Thanks for the reply.
I have use AJAX a little bit, bu I am unfamiliar with calling a pag
with AJAX. Any ideas on the syntax to do this?
I thought AJAX was more for making server calls.......
I've just been doing something like this using dojo (
www.dojotoolkit.org),
which makes it pretty easy:
function infoPage(url,ca llback) {
// the url to load.
this.url=url;
// is the file loaded and parsed?
this.ready= false;
// did the loading fail?
this.fail=false ;
// reference to a div with the page in it.
this.infoNode=n ull;
// callback for when the html has loaded.
this.callback=c allback;
this.load= function() {
// load the data file.
var bindArgs = {
url: this.url,
mimetype: "text/html",
error: dojo.lang.hitch (this,"loadErro r"),
load: dojo.lang.hitch (this,"loaded")
};
var requestObj = dojo.io.bind(bi ndArgs);
};
this.loaded=fun ction(type, data, evt){
// handle successful response here
// parse HTML into DOM nodes.
var newNodes=dojo.h tml.createNodes FromText(data,t rue);
this.infoNode=n ewNodes[0];
// callback which does any further processing - e.g. inserting the node
in the document.
this.ready=true ;
this.callback(t his);
};
this.loadError= function(type, errObj){
// handle error here
this.fail=true;
alert("Failed to load page");
}
}
If you don't like toolkits, you'll probably have to write your own
javascript to parse html into DOM nodes, or else use innerHTML.