I have a JavaScript code in my CSHTML. When I click the button it runs a function. But in some windows App.ServisTanimId.getValue()
is undefined
. That’s why my button doesn’t work. Is there any way like to check if App.ServisTanimId.getValue()
is undefined and only then do it?
Pencere = function(parameters) {
Ext.net.directRequest({
url: '@(Url.Action("window", "Home", new { Area = "area" }))',
extraParams: {
ServisTanimId: App.ServisTanimId.getValue(),
CepDepoTanimId: App.CepDepoTanimId.getValue()
},
eventMask: {
showMask: true
}
});
};
if(App.ServisTanimId) {
// This code will execute if App.ServisTanimId is defined
} else {
// If undefined
}
should work