I am working in Ajax request to send data in Controller by using Jquery, all the fields are got fine @controller, but only one field Date("AffectedDate") is not coming.
can anybody tell me where 'm wrong?
JQuery Code:
function saveData() {
var data = $("#editForm").serialize();
$.ajax({
type: 'GET',
url: '/Controller/SaveTaxRate/',
data: data,
success: function (result) {
alert('success');
},
error: function (jqXHR) {
alert('failure');
}
})
}
.Cs Model:
public class TaxRateModel
{
public int CountryId { get; set; }
public string CountryName { get; set; }
public double? Taxes { get; set; }
public float? AffectedTaxRate { get; set; }
public Nullable<System.DateTime> AffectedDate { get; set; }
}
Controller Code:
public bool SaveTaxRate(TaxRateModel taxRateModel)
{
// My Code here..
}
HTML Code:
<div class="row-fluid">
<div class="span12">
<div class="span3">
<p><strong>Country: </strong></p>
</div>
<div class="span5">
@Html.TextBoxFor(Model => Model.CountryName, new { @placeholder = "Change the Country Name" })
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="span3">
<p><strong>Tax-Rate: </strong></p>
</div>
<div class="span5">
@Html.TextBoxFor(Model => Model.Taxes, new { @placeholder = "Chnage the Tax-Rate", @id = "TaxRate" })
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="span3">
<p><strong>Affected Tax-Rate: </strong></p>
</div>
<div class="span5">
@Html.TextBoxFor(Model => Model.AffectedTaxRate, new { @placeholder = "Change the TaxRates" })
</div>
</div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="span3">
<p><strong>Affected Date: </strong></p>
</div>
<div class="span5">
@Html.TextBoxFor(model => model.AffectedDate, "{0:dd/MM/yyyy}", new { @placeholder = "Change the Affected Date" })
</div>
</div>
</div>