I am trying to make a call from views to controller using jquery. however it never call controller.

I have a Umbraco 7.1.2 website in asp.net MVC 4 application.


var dp = jQuery;
dp(document).ready(function() {

function GetTestimonials() {
        type: 'GET',
        url: '/Home/GetTestimonialsList',
        cache: false,
        success: function (data) {
            dp.each(data, function (index, val) {
                alert(val.Name + val.Comment + val.Date);
        error: function () {

Then my controller

public JsonResult GetTestimonialsList()
     var model = _spdb.TestimonialDetails.Where(t => t.Status == Enums.TestimonialsStatus.approved).Select(t => new { t.Comment, t.Name, t.Date});
     return Json(model, JsonRequestBehavior.AllowGet);

I put a breakpoint on the controller, it never got called.

On the browser, no errors were raised with jquery.

However it always triggers alert("error"); when page loads.

I called console.log("test"); it displays on the browser debug.

On same page I am making a form post to controller using jquery and it has no problem at all.

the query from db gives me the data right.

What am I doing wrong?

Thanks a lot

Related posts

Recent Viewed