Guest User

Untitled

a guest
Jan 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. function getCountries()
  2. {
  3. // alert();
  4. var obj = {};
  5. obj.countryName = '';
  6. $.ajax({
  7. type: 'GET',
  8. url: '/Business/GetCountries',
  9. dataType: 'json',
  10. async: false,
  11. success: function (data) {
  12.  
  13. console.log(data);
  14.  
  15.  
  16.  
  17. },
  18. error: function (err) {
  19.  
  20. console.log(err);
  21. }
  22. });
  23.  
  24.  
  25. }
  26.  
  27. [HttpGet]
  28. [Route("Countroller/GetCountries")]
  29. public JsonResult GetCountries(string countryName)
  30. {
  31. //List<countries_model> countrylist = null;
  32. var myresult = "{'name':'John', 'age':31, 'city':'New York' }";
  33. return Json(myresult,JsonRequestBehavior.AllowGet);
  34. }
  35.  
  36. public static void RegisterRoutes(RouteCollection routes)
  37. {
  38. routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  39.  
  40. routes.MapRoute(
  41. name: "Default",
  42. url: "{controller}/{action}/{id}",
  43. defaults: new { controller = "Home", action = "signup", id = UrlParameter.Optional },
  44. namespaces: new[] { "timeclock.controller" }
  45. );
  46.  
  47. routes.MapMvcAttributeRoutes();
  48. }
Add Comment
Please, Sign In to add comment