taghandler jquery mvc 3

时间:2012-08-03 02:52:58

标签: jquery ajax asp.net-mvc-3

我需要从我的应用程序MVC 3中的插件jquery.tagHandler的ajax请求中获取数据,这是页面官方http://ioncache.github.com/Tag-Handler/,这是我的应用程序的代码:

    $("#tags").tagHandler({
        getData: { texto: 'test 123' },
        getUrl: '@(Url.Action("GetTags"))',
        autocomplete: true,
        maxTags: 5,
        initLoad : true
    });

    [HttpGet]
    public JsonResult GetTags(string texto)
    {
        var result = _ServiceTags.Search(texto);

        return Json(result);
    }

在安排我的应用程序时,这不会调用方法GetTags。

请帮助!!!

提前致谢

1 个答案:

答案 0 :(得分:0)

MVC3具有JsonResults的安全功能。您需要将退货修改为:

return Json(result, JsonRequestBehavior.AllowGet);