I am trying to pass an int value from a View to a class, which later calls another function based on the int value.
The class I'm calling is called DataFetch.cs
which has a function named GetLogs(int x);
What I have in the View is;
@Html.ActionLink("Connect",
"GetLogs()", "DataFetch", new {id = item.MacNum}, new { @class = "DataFetch" })
^This gives me the url:
http://localhost:xxx/DataFetch/GetLogs()/1
Which obviously isn't what I want.
UPDATE:
function GetCloud()
{
console.log("insidefunc");
$.ajax({
type: "POST",
url: '/DataFetch/GetLogs?id=' + 1,
data: 1,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
alert("done")
},
failure: function (response) {
alert("Failed: " + response.responseText);
},
error: function (response) {
alert("Error: " + response.responseText);
}
});
}
This did not work either.