Messing around with Dojo has been great fun, sometimes frustrating with the latest 0.9 Dojo release and the lack of documentation. But, after much picking at my script, I was able to create simple forms, send them and receive information through Dojo’s xh
Messing around with Dojo has been great fun, sometimes frustrating with the latest 0.9 Dojo release and the lack of documentation. But, after much picking at my script, I was able to create simple forms, send them and receive information through Dojo’s xhrGet function.
Include the following code within the <head> and </head> tags of your document.
<code> <script type=”text/javascript” src=”/path to dojo/dojo.js” djConfig=”parseOnLoad:true”></script> </code>
Include the form widgets you would like to use. I have the basics below:
Now for our main function <code> function getFormData() { var kw = { url: “/path to your php page handler/pagename.php”, //Explicit Path - leaving out the leading / seemed to break the code load: function(data){ dojo.byId(’formdata’).innerHTML = data; // where do you want your data to be returned. }, error: function(data){ alert(”An error occurred: ” + data); //in case of error }, timeout: 2000, form: “login” //what form }; dojo.xhrGet(kw); } </code>