I have a problem with using Ajax.
function GetGrantAmazonItemCnt(){
var cnt;
Ext.Ajax.request({
url : \'\',
params : {},
succ
Because the AJAX request is asynchronous, your cnt variable will return before the request comes back and the success handler is called.
I would suggest refactoring your code to account for this.
One way to do this is to call whichever function that called GetGrantAmazonItemCnt() from the success handler of your AJAX request, this way passing the value to where it needs to go:
function GetGrantAmazonItemCnt(){
var cnt;
Ext.Ajax.request({
url : '',
params : {},
success :function(response){
cnt = response.responseText;
FunctionThatCalledMe(cnt);
}
});
}