<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN”
“http://www.w3.org/TR/html4/strict.dtd”>
<html>
<head>
<title>Dojo</title>
<!– load the dojo toolkit base –>
<script type=”text/javascript” src= “dojo/dojo/dojo.js”
djConfig=”parseOnLoad:true, isDebug:true”></script>
<script type=”text/javascript”>
// Load Dojo’s code relating to the Button widget
dojo.require(“dijit.form.Button”);
</script>
<script>
function helloCallback(data,ioArgs) {
alert(data);
}
function helloError(data, ioArgs) {
alert(‘Error when retrieving data from the server!’);
}
</script>
<form id=”myForm” method=”POST”>
Please enter your name: <input type=”text” name=”name”>
</form>
<button dojoType=”dijit.form.Button” id=”helloButton”>
Click here to read data from the server!!
<script type=”dojo/method” event=”onClick”>
dojo.xhrPost({
url: ‘SendRequestbyPOST.jsp’,
load: helloCallback,
error: helloError,
form: myForm
});
</script>
</button>
<br>
<style type=”text/css”>
/* CSS */
.testClass {
background-color:red;
}
</style>
</head>
<body>
<h1 id=”testHeading”>Dojo Send Data by POST</h1>
<div id=”contentNode”>
<p></p>
</div>
</body>
</html>
///NOTE: Create a simple jsp page to read Query String parameter : Name.
///something like: <%= request.getParameter(“name”) %>
// and name it as : SendRequestbyPOST.jsp
Filed under: Dojo
alert(“hiiiiiiiiiiiiiii”);