Having trouble passing a parameter to a function and adding it to the read function in my script. I added a parameter called val to make the function reusable, but unsure how to integrate it into objhandler.read('one').
Here's what I have in my .js file:
var objHandler = new Interact();
function SayRead() {
try {
objHandler.Read(function (serverResponse) {
if (serverResponse.error == null) {
var result = serverResponse.result;
if (result.length > 2) {
SessionStore.loadData(Ext.decode(result));
}
}
else {
alert(serverResponse.error.message);
}
});
} catch (e) {
alert(e.message);
}
}
SayRead();
In my .ashx.cs file:
public class Interact : JsonRpcHandler
{
[JsonRpcMethod()]
public string Read(string val)
{
clsDBInteract objDBInteract = new clsDBInteract();
string result;
try {
if (val == "one")
result = objDBInteract.FetchSessionsJSON();
} catch (Exception ex) {
throw ex;
}
return result;
}
}
P.S: Using jayrock library.
Thank you.