I am writing Spring web MVC app whereby the client and the server communicates by sending json messages.
On the client I am making asynchronous calls to update textboxes. Could you please let me know if I am using the right syntax? I have hit a brick wall and cannot see what I am doing wrong.
The function is called when user enters text in textbox. The application uses the code below to send char entered to server, the server returns a json object.
<script type="text/javascript">
dojo.require("dijit.form.TextBox");
dojo.require("dojo.parser");
function convertToDecimal(){
var targetNode = document.getElementById("key");
var xhrArgs ={
url: "/AjaxJavaDojo/",
handleAs: "json",
headers: {
"Content-Type": "text/json"
},
load: function(data){
target.value = "load";
},
error: function(error){
target.value = "error";
}
};
//call asynchronously
var deferred = dojo.xhrGet(xhrArgs);
}
dojo.addOnLoad(convertToDecimal);
</script>