New to Dojo Toolkit, I’m able to successfully get an xhrGet to load on page load but I need to load the xhrGet when a row of a DataGrid is selected. Is there even a way to do so?
<!doctype html>
<html>
<head>
<script type="text/javascript>
dojo.connect(btn, "onclick", function() {
/************************/
/* xhr - AJAX functions */
/************************/
dojo.ready(function(){
var targetNode = dojo.byId("xhr-container");
var xhrArgs = {
url: "info-to-get.html",
handleAs: "text",
load: function(data){
targetNode.innerHTML = data;
},
error: function(error){
targetNode.innerHTML = "You messed up, dummy!: " + error;
}
}
var deferred = dojo.xhrGet(xhrArgs);
});
});
</script>
</head>
<body>
<button type="button" id="btn">TEST</button>
<br>
<br>
<div id="xhr-container"></div>
</body>
</html>
The xhrGet works fine by itself on page load, no dice when trying to call it through a button.
This will wire up the click of an html domNode to firing a function where you can put your xhr code.
If it is a widget, like
dijit.form.Buttonyou can write–EDIT ———————-
Based on your posted code, I would expect the following to work: