Jquery自动完成包含帖子数据

I have a script with autocomplete, get some data from an external source according to searched term. I can output the json in the console but I'm struggling to pass it to the response, how do I do that?

      $('#test').autocomplete({
        source: function(request,response){
            $.post('/schoollookup', {
               query: request.term
            }, function(data){
                }, 'json'
            );
        },
        minLength: 2
    });
$.ajax({
  type: "POST",
  url: url,
  data: data,
  success: success,
  dataType: dataType
});

This is the syntax for post request. where

url : A string containing the URL to which the request is sent.

data : A plain object or string that is sent to the server with the request.

success : callback function

@Sumesh

    $.post('/schoollookup', {

should be working the same, the difficulty that I have is to get response

Thank you for your answer r007ed, the issue was that it was not returning an array. So the final code for this is :

    $('#test').autocomplete({
        source: function(request,response){
            $.post('/schoollookup',{query: request.term}, response, 'json');
        },
        minLength: 2
    });