var cType = function(templateId){
dojo.xhrPost({
url : "/mediation1.0.1/template/getCollectorType",
handleAs : "text",
headers : {"Content-Type":"text/html"},
postData : templateId,
load: function(data){
return data;
}});
};
When I call this function with cType(withSomeId), I get undefined.
Even When I take local variable and assign data to that variable, returning thatvariable also not helping.
The problem is that your cType function does not return anything.
You should be using
dojo.Deferredto accomplish what you are trying to do:http://dojotoolkit.org/reference-guide/1.7/dojo/xhrGet.html (This has an example that shows the deferred technique)
http://dojotoolkit.org/reference-guide/1.7/dojo/xhrPost.html