@model IEnumerable<TBWeb.Models.SP_GetALlRoutes_Result>
@{
ViewBag.Title = "Rutas";
Layout = "~/Views/Shared/_Layout.cshtml";
string fecha=string .Empty ;
}
<script language="JavaScript" type="text/JavaScript">
$('#FechaInicio').onchange(function (){
fecha= document.getElementById("FechaInicio").value;
)};
</script>
<input type="text" id="FechaInicio">
答案 0 :(得分:0)
@model IEnumerable<TBWeb.Models.SP_GetALlRoutes_Result>
@{
ViewBag.Title = "Rutas";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<input type="text" id="FechaInicio">
<script language="JavaScript" type="text/JavaScript">
$(function() { //wait for doc ready before trying to wire up to element
//use jquery event handler for text change: 'input' event is an on change event
$('#FechaInicio').on('input', function (){
var inicio = $(this).val();//this refers to the FechaInicio element the input event fired on
//send to controller action
$.ajax({
url: @Url.Action("SomeActionName"),
type: 'POST',
data: {
whateverParamNameIsIncontrollerAction: inicio
},
success: function (result) {
//do whatever after request completes
}
});//ajax
)};//on input
)};//doc ready
</script>