I want to pass element from model to "setlaneOnFloor" method in .cshtml but error said they not exist.
<script>
function setlane(){
let floor = document.getElementById("floor");
let lane = document.getElementById("lane");
@Model.setlaneOnFloor(floor,lane)
}
</script>
[WebMethod]
public string setlaneOnFloor(int floor, int num)
{
return cmd.setlaneinsection(floor, num);
}
i also try this but i flews like I'm do something wrong.
<script>
function setlane(){
var data = { floor: document.getElementById("floor"), num: document.getElementById("lane") };
$.ajax({
type: "POST",
url: '\<%= ResolveUrl("\~/setlaneOnFloor") %\>',
data: JSON.stringify(data),
contentType: "application/json",
success: function (msg) {
$("#txtStartDate").val(msg.d);
}
});
}
</script>
I want to pass the element something like this
@Model.setlaneOnFloor(5,6)\
WebMethodattribute ? what is your framework?