Hi all.
I cannot pass the values from the textboxes onm a form to the controller.
view code
<script type="text/javascript">
$(document).ready(function () {
$("#btnSubmit").click(function () {
var presc1 = $('#p1').val(),
aviad1 = $('#a1').val(),
$.ajax({
type: "POST",
dataType: "json",
contentType: "application/json; charset=utf-8",
url: "comparar",
data: "{'presc1':'" + presc1 + "', 'aviad1':'" + aviad1 + "'}",
});
});
});
</script>
<div Class="container">
@Html.BeginForm("comparar", "prescavi/comparar", FormMethod.Post)
<div Class="col-md-12 col-xs-12">
<div Class="col-md-6 col-xs-6">
<div Class="col-md-4 col-xs-4">
<Label for="prescrito1"></Label>
</div>
<div Class="col-md-4 col-xs-4">
@Html.TextBox("p1")
</div>
</div>
<div Class="col-md-6 col-xs-6">
<div Class="col-md-4 col-xs-4">
<Label for="aviado1"></Label>
</div>
<div Class="col-md-4 col-xs-4">
@Html.TextBox("a1")
</div>
</div>
</div>
<br><br>
<div Class="col-md-12 col-xs-12">
<div Class="col-md-6 col-xs-6">
<div Class="col-md-4 col-xs-4">
<Label for="nada1a"></Label>
</div>
<div Class="col-md-4 col-xs-4">
<Label for="nada1b"></Label>
</div>
</div>
<div Class="col-md-6 col-xs-6">
<div Class="col-md-4 col-xs-4">
<Label for="nada2a"></Label>
</div>
<div Class="col-md-4 col-xs-4">
<input type="submit" name="btnSubmit" value="Send" />
</div>
</div>
</div>
</div>
controller code
Public Function Comparar(ByVal presc1 As String, ByVal aviam1 As String)
Return "you entered " & presc1 & " and " & aviam1 & ""
End Function
how to pass the data?
thanks in advance