Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getCountries()
- {
- // alert();
- var obj = {};
- obj.countryName = '';
- $.ajax({
- type: 'GET',
- url: '/Business/GetCountries',
- dataType: 'json',
- async: false,
- success: function (data) {
- console.log(data);
- },
- error: function (err) {
- console.log(err);
- }
- });
- }
- namespace timeclock.controller
- {
- class BusinessController : System.Web.Mvc.Controller
- {
- [HttpGet]
- [Route("Countroller/GetCountries")]
- public JsonResult GetCountries(string countryName)
- {
- //List<countries_model> countrylist = null;
- var myresult = "{'name':'John', 'age':31, 'city':'New York' }";
- return Json(myresult,JsonRequestBehavior.AllowGet);
- }
- }
- }
- public static void RegisterRoutes(RouteCollection routes)
- {
- routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
- routes.MapRoute(
- name: "Default",
- url: "{controller}/{action}/{id}",
- defaults: new { controller = "Home", action = "signup", id = UrlParameter.Optional },
- namespaces: new[] { "timeclock.controller" }
- );
- routes.MapMvcAttributeRoutes();
- }
Add Comment
Please, Sign In to add comment