jQuery UI Autocomplete with ASP MVC

五迷三道 提交于 2019-12-03 20:16:51

I use this before my first AJAX request -- I bet it will help. Defines the standard items and takes care of the "d" attribute microsoft puts in as the top level attribute.

  $.ajaxSetup({
     type: "POST",
     contentType: "application/json; charset=utf-8",
     data: "{}",
     dataFilter: function(data) {
        var msg;

        if (typeof (JSON) !== 'undefined' && typeof (JSON.parse) === 'function')
           msg = JSON.parse(data);
        else
           msg = eval('(' + data + ')');

        if (msg.hasOwnProperty('d'))
           return msg.d;
        else
           return msg;
     }
  });
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!