I am using JQUERY ajax to call an MVC method:
JQUERY:
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/Home/GetApplication/" + id,
dataType: "json",
data: '',
timeout: 10000,
success: function (obj) {
$('#Name').val(obj.Name);
$('#ApplicationIdentifier').val(obj.ApplicationIdentifier);
$('#Frequency').val(obj.FrequencyValue);
var d = new Date(parseInt(obj.BaseDate.substr(6)));
$('#BaseDate').val(d.getMonth() + '/' + d.getDay() + '/' + d.getFullYear());
},
error: function () {
return;
}
});
MVC Method:
[HttpPost]
public ActionResult GetApplication(int id)
{
return Json(new Application
{
Name = "Testing",
ApplicationIdentifier = "123ABC",
FrequencyValue = 1,
FrequencyType = 1,
BaseDate = DateTime.Now
});
}
All of this works fine except the date appearing on my form is 4/5/2011 and it should be 5/13/2011. Am I missing something here? Thanks.
obj.BaseDate?