url path to hit the controller method in jquery


Model PageType:SamplePage.cs
public virtual XhtmlString MainBody { get; set; }

Controller: SamplePageController.cs
public ActionResult Index(SamplePage currentPage)

PageViewModel model = new PageViewModel(currentPage);
return View(model);


public ActionResult Getresult(string sector)
List data = new List(Getvalues());
var objList = data.Where(a => a.Sector == sector).ToList();

return Json(objList, JsonRequestBehavior.AllowGet);

@model EPiServerSite1.Models.ViewModels.PageViewModel

When I created the page, I could see the options listed above on the page.

Based on the selection of item, I would need to call the 'Getresult' in the controller, the following script is working fine in a normal MVC
application, but the controller method(Getresult) is not hit in the episerver site when I put a breakpoint. Is the url path in EPiServer not the same
as we write in MVC?
What's the path to be entered in the jquery url to hit the action in controller in EPiServer?

Nov 18, 2014 15:39

This is an interesting subject so I did a quick search.

I found this post : Rest Service

Maybe it will help

Edited, Nov 18, 2014 17:04

This has got solved as below

var MyAppUrlSettings = {
MyUsefulUrl: '@Url.Action("Getresult","SamplePage")'


            url: MyAppUrlSettings.MyUsefulUrl,  


Edited, Nov 19, 2014 0:29