Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, November 19, 2013 8:47 AM
Hey guys.
I think this is pretty basic but I'm starting to go crazy because I cant seem to know what is wrong.
I'm trying to pass some values with url.action link from my view to my controller.
<script>
$(document).ready(function () {
var groupCombobox = $("#groupCombobox").data("kendoComboBox");
$("#get").click(function () {
var url = '@Url.Action("MachineStatusChart", "MachineStatusChart", new { group = "Group1", machine="Machine1" })';
window.location.href = url;
});
});
</script>
public ActionResult MachineStatusChart(string group = "", string machine = "")
{
string test = group;
string test2 = machine;
}
Now I can get value for the group but not for machine variable.
Any ideas :) ?
All replies (2)
Tuesday, November 19, 2013 9:43 AM âś…Answered
in url replace Group1 with real value of the group
url =url .replace("Group1",'the new value');
Tuesday, November 19, 2013 12:32 PM
var url = '@Url.Action("MachineStatusChart", "MachineStatusChart", new { group = "Group1", machine="Machine1" })';
check what is contains inside url. Please note that Url.Action is depend upon your routes.