<script type="text/javascript">
$(function() {
alert("This is equal to Form_Load in JQuery");
});
</script>
Thursday, April 9, 2009
If getJSON in JQuery can not find exact signature method in Controller, it fails silently.... (ASP.NET MVC)
it fails silently....
Microsoft should put a couple of exclaimation marrk for this documentation somewherem, so we can see to save us sometime!!!!!!!!!!!!!!!!!!!!!!!!!
Example:
If you call getJSON in client side:
$.getJSON('/Home/GetList', { id: $("#country").val() },
You have to create an action in controller in following:
public JsonResult GetList(string id)
{
return Json(test.ToList());
}
But if you:
public JsonResult GetList(int id)
{
return Json(test.ToList());
}
You got nothing!!!!!!!!!!!!!!!!
Microsoft should put a couple of exclaimation marrk for this documentation somewherem, so we can see to save us sometime!!!!!!!!!!!!!!!!!!!!!!!!!
Example:
If you call getJSON in client side:
$.getJSON('/Home/GetList', { id: $("#country").val() },
You have to create an action in controller in following:
public JsonResult GetList(string id)
{
return Json(test.ToList());
}
But if you:
public JsonResult GetList(int id)
{
return Json(test.ToList());
}
You got nothing!!!!!!!!!!!!!!!!
Subscribe to:
Posts (Atom)