如何使用制表符通过 ajax 提供工具提示文本?

How to feed tooltip text through ajax using tabulator?

我想通过请求 Ajax 调用来填充我的额外信息工具提示。

这是我的 JS table:

    var table = new Tabulator("#GridView1", {
        layout: "fitColumns",
        columns: [
            { title: "Autor PC", field: "Autor PC", width: 200, tooltip: function (cell) { return mouseover(cell.getValue()); } },
            //Other columns........
        ]
    });

这是我定义 AJAX 调用的函数。

function mouseover(user) {
    $.ajax({
        type: "GET",
        url: "AjaxServices.asmx/UsuarioInfo",
        data: JSON.stringify('{usuario: "' + user + '" }'), 
        contentType: "application/json; charset=UTF-8",
        dataType: "json",
        success: function (msg) {
            alert("correct: "+ msg.d);
        },
        error: function (msg) {
            alert("error: " + msg.d);
        }
    }); 
}

现在在这个 webform 项目中,我创建了一个 .asmx 文件,它具有 webmethod 的定义...

    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class AjaxServices : System.Web.Services.WebService
    {
        [WebMethod]
        public static string UsuarioInfo(string usuario)
        {
            //My logic that will return the user info...
        }
    }

我做了很多研究,但找不到任何解决方案...我做错了什么?这可能吗?

经过一段时间试图找出发生了什么,我只是让调用同步并解析为 JSON...

function mouseover(user) {

    return JSON.parse($.ajax({
        type: "POST",
        url: "AjaxServices.asmx/UsuarioInfo",
        async: false,
        data: '{ "usuario": "' + user + '"}', 
        contentType: "application/json; charset=UTF-8",
        dataType: "json",
        success: function (msg) {
            return msg.d;
        },
        error: function (msg) {
            //alert("erro " + msg.d);
        }
    }).responseText).d; 
}

然后我能够在工具提示中获得我的响应字符串和 return 到我的函数。

tooltip: function (cell) { return mouseover(cell.getValue()); }