Thursday, April 9, 2009

onload event in JQuery

<script type="text/javascript">
$(function() {
alert("This is equal to Form_Load in JQuery");

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!!!!!!!!!!!!!!!!!!!!!!!!!

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!!!!!!!!!!!!!!!!