|
Page 1 of 2 So there is a wide world of tools and methods for "web 2.0", and for developers it is hard to know which one to chose to use and support. I have tinkered with two AJAX toolkits and found things that I liked and disliked with them. But overall I found that they were both too big and too feature rich for simple use. So it occured to me that for some of my simple projects all I needed was bare-bone functionality, meaning the ability to fetch the contents of a given url. Beyond that I can do what I need in small simple javascript. I didn't need fancy event handling, or animation, or auto-complete drop downs, or such. And if I did, then I could probably do that my self later, as long as I had the ability to easily fetch a URL.
Thus I started putting together a new AJAX toolkit named oddly enough AJAXMinimal. This is comprised of a single .js file that provides an object with one method call, fetch_url(). That's it. Simple, easy to use. Does the job. Let's dive into an example of how to use AJAXMinimal, as I think that is a good way to explain the hows and whys and such. I have an HTML page with three buttons, each of which I want to fetch a given URL and then load the contents of that dynamically into a certain DIV within my page. Thus dynamically changing my page without refreshing the whole thing. Here is body of the HTML: <body> <h1>Test page index</h1>
<form name="main_form" action="" onsubmit="return false"> <input type="button" name="button1" id="button1" value="Button 1" onclick="load_html(this);"/> <input type="button" name="button2" id="button2" value="Button 2" onclick="load_html(this);"/> <input type="button" name="button3" id="button3" value="Button 3" onclick="load_html(this);"/> </form>
<div id="outer_div"> Outer Div <div id="inner_div"> Inner Div </div> </div>
</body>
|