Doing AJAX with popular javascript libraries

| Basic | Prototype.js | Dojo Toolkit | Yahoo UI Library | ASP.NET | Rails |

DojoToolkit

The DojoToolkit is an awesome collection of javascript goodies. Though not very lightweight, it has many cool javascript API's and ready-to-use widgets. The dojo.io package provides functionality for AJAX. A typical AJAX call with dojo will look like this:
<script language="javaScript" 
type="text/javascript" src="js/DOJO/dojo.js">

dojo.require("dojo.io.x.*");
dojo.require('dojo.event.*');

dojo.io.bind({
url: "your_URL",
load: function(type, data, evt){ alert(data); },
error: function(type, error){ alert('There was a problem'); },
mimetype: "text/plain"
});
</script>
The mimetype 'text/plain' indicates we expect plain text or JSON response. The rest looks self-explanatory and somewhat similar to prototype's implementation. Another interesting thing which it does is , submitting of HTML forms via AJAX
<form name="pwd_verify" id="pwd_verify" method=post>
<input name="nam"  type=text />
<input  name="pwd" type=password />
</form>
dojo.io.bind({
url: "http://ashishware.com/password.cgi",
load: function(type, evaldObj){ alert(evaldObj); },
formNode: document.getElementById("pwd_verify")
});
There is one more interesting thing, 'File Upload without Files'. Yes this may sound strange, what it means you send some data, with contenty-type and filename .
  • Dojo has a powerful javascript API and may amazing widgets. If you are considering making a website, with complex UI, animation, drag-drop, widgets and hell lot of javascript, you may not find better things than Dojo.
  • In my opinion Dojo is a near perfect client-side/javascript framework, that can be used with multiple web development frameworks.
| Basic | Prototype.js | Dojo Toolkit | Yahoo UI Library | ASP.NET | Rails |


Copyright (c) 2007-2017 Ashish Patil . Please read FAQ for more details.

comments powered by Disqus