grupoantolin
Jun 02, 2016, 12:26 PM
Hello.
I need to call from a JavaScript to a Controller's Action.
I am trying with
Ext.Ajax.request({url: 'controller/action', param1: value1, param2: value2})
But i can't.
For example, in the next .cshtml:
function AddToCart(id) {
Ext.Ajax.request({url: 'shell/ActionAdd', param1: "10"})
}
X.Button().OnClientClick("AddToCart")
and the controller class ShellController:
public ActionResult ActionAdd()
{
//Do something
return this.Direct();
}
How can i do it?
I know i can use the DirectEvents and the URL.Action(""), but i need to call the action from the javasript.
I need to call from a JavaScript to a Controller's Action.
I am trying with
Ext.Ajax.request({url: 'controller/action', param1: value1, param2: value2})
But i can't.
For example, in the next .cshtml:
function AddToCart(id) {
Ext.Ajax.request({url: 'shell/ActionAdd', param1: "10"})
}
X.Button().OnClientClick("AddToCart")
and the controller class ShellController:
public ActionResult ActionAdd()
{
//Do something
return this.Direct();
}
How can i do it?
I know i can use the DirectEvents and the URL.Action(""), but i need to call the action from the javasript.