Created
August 26, 2010 15:50
-
-
Save anonymous/551650 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html dir="ltr"> | |
<head> | |
<link rel="stylesheet" type="text/css" href="../js/dijit/themes/claro/claro.css" /> | |
<style type="text/css"> | |
body, html { font-family:helvetica,arial,sans-serif; font-size:90%; } | |
</style> | |
</head> | |
<body class=" claro "> | |
<form id="myform" action="test.php" method="post"> | |
<input type="text" dojoType="dijit.form.TextBox" name="text" value="some text"></input> | |
<br> | |
<button type="submit" dojoType="dijit.form.Button" id="submitButton"> | |
Send it! | |
</button> | |
</form> | |
<div id="response"> | |
</div> | |
</body> | |
<script type="text/javascript" src="../js/dojo/dojo.js" djConfig="parseOnLoad: true"> | |
</script> | |
<script type="text/javascript"> | |
dojo.require("dijit.form.Button"); | |
dojo.require("dijit.form.TextBox"); | |
function sendForm() { | |
var button = dijit.byId("submitButton"); | |
dojo.connect(button, "onClick", function(event) { | |
event.preventDefault(); | |
event.stopPropagation(); | |
var xhrArgs = { | |
form: dojo.byId("myform"), | |
handleAs: "text", | |
load: function(data) { | |
dojo.byId("response").innerHTML = "Form posted."; | |
}, | |
error: function(error) { | |
dojo.byId("response").innerHTML = "Form posted."; | |
} | |
} | |
dojo.byId("response").innerHTML = "Form being sent..." | |
var deferred = dojo.xhrPost(xhrArgs); | |
}); | |
} | |
dojo.addOnLoad(sendForm); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment