Skip to content
Advertisement

ivirabyan/jquery-mentions how to check ajax request respone

I am using ivirabyan/jquery-mentions in my project. i can do ajax request, but the problem is how can i use the response

$('textarea.mentions').mentionsInput({
    source: function( request, response ) {

        $.ajax({
            url: rootPath() + "user/tagFriends/" + request.term,
            type: "GET",
            dataType: "json",

            success: function(data){
              alert(data);
              // found data here
            }
        });
    },
    showAtCaret: true

});

Thanks in advance.

Advertisement

Answer

You can try this code, it may work

$('textarea.mentions').mentionsInput({
source: function( request, response ) {

    $.ajax({
        url: rootPath() + "user/tagFriends/" + request.term,
        type: "GET",
        dataType: "json",

        success: function(data){
          response(data);
          // Just add this line
        }
    });
},
showAtCaret: true
}); 
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement