Posted By

root_hacker on 10/25/11


Tagged

ajax aspnet-mvc


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

jillella


ajax with asp.net mvc3


 / Published in: C#
 

accessing getdev action of home controller which returns jsonresult

  1. $.ajax({
  2. type: "GET",
  3. url: "/home/getdev",
  4. data: "{}",
  5. contentType: "application/json; charset=utf-8",
  6. dataType: "json",
  7. success: function(msg) {
  8. // Do something interesting here.
  9. console.log(msg);
  10. }
  11. });//ajax ends here
  12.  
  13.  
  14.  
  15. public JsonResult GetDev()
  16. {
  17. return Json(new {author = "najam sikander awan", email="najamsk@gm[email protected]"},JsonRequestBehavior.AllowGet);
  18. }

Report this snippet  

You need to login to post a comment.