Thursday, June 29, 2006

dojo.io.bind

YES !
Actualy, I tried to submit a form to our server, but it has to go through AJAX protocol. I wish I could do it on mochikit library, but in order to mr.Bob Ipolito said, "there no plan to add a POST mechanism on mochi library". So I'm stuck.

Lucky me , Dojo library support it, they support form submit via XMLHTTPRequest protocol. Its little be hard to find how to do it, since dojo still under heavy development, but thanks to mr.google, heres the way I did on my code :

This is part of my button action / signal

var my_url = this.ajax_url+"ajax/ajax.items.php?task=test";
dojo.io.bind({ url : my_url,
load: function(type, data, evt)
{
alert(type);
alert(data);
alert(evt);
var rows = data.rows;
var cols = data.columns;
alert(cols[0]);
alert(rows[0]);
the_object.value = data;
},
formNode: getElement("aoiForm"),
mimetype:'text/json' });

You may found in this part of javascript code, there's as simple as mochikit did. Thats why I'll stick my GET method with mochikit and do the POST method with dojo.