I want to do a simple procedure, where a user submits a form from the front-end using POST and a success message comes back in a specified div id without page-refresh. How do i do that using dojo.io.bind?
As of Dojo 0.3.0, you can use the dojo.io.updateNode method to simplify the case where you want to do innerHTML replacement.
dojo.io.updateNode("target_div_id", {
formNode: dojo.byId("your_form_id"),
method: "post"
});
Using formBind like this also helps to prevent memory leaks since the replaced content will have dojo.event.browser.clean() called over it prior to removal.
Regular-old dojo.io.bind() supports submitting forms and will take it's configuration from the from unless you over-ride it.
dojo.io.bind({
formNode: dojo.byId("your_form_id"),
load: function(type, data, evt){/* do something with the return */}
});
In this example we expect the form node that is passed to have action and method properties defined which will determine the url and method arguments to the bind call.