I have two fields date in my form (frm-Pesquisa-Totais-Tempos-UM) and i'm using Jquery serialize to send that informations to controller:
$('.input-daterange').datepicker({
format: "dd/mm/yyyy",
todayBtn: "linked",
language: "pt-BR"
});
$("#btn-Pesquisar").click(function () {
var form = $('#frm-Pesquisa-Totais-Tempos-UM');
$.ajax({
cache: false,
async: false,
url: form.attr('action'),
data: form.serialize(),
success: function (retorno) {
if (retorno.success != false) {
angular.element(document.getElementById('grd-Resultado')).scope().atualizarRegistros(retorno);
}
}
});
});
<div class="col-sm-5 col-md-4 col-lg-3">
<div class="form-group">
<label>Período</label>
<div class="input-daterange input-group" id="datepicker">
@Html.TextBoxFor(model => model.Parametros.DT_INICIO, new { @id = "txt-dtInicio", @class = "form-control input-sm" })
<span class="input-group-addon">Até</span>
@Html.TextBoxFor(model => model.Parametros.DT_FIM, new { @id = "txt-dtFim", @class = "form-control input-sm" })
</div>
</div>
</div>
If i use type: "POST" in my ajax call, all dates are putting in the corret format in my controller (dd/mm/yyyy). But when I remove type post and call the controller by "GET", the date arrived in my controller in a different format (mm/dd/yyyy).
I need to use get because when i use post I can't show a loading image during the process.
What it's the best way to correct it?