Custom plugin who accepts parameters for showing results from api

Custom plugin who accepts parameters for showing results from api

Hello to all, can someone please help me to do jquery plugin. I have an assignment to do plugin to use like $('element').customPlugin({'showResults': 10}). Default is 10 but it can be changed. I made my plugin but i don't know how to limit results. My plugin looks like

$.fn. customPlugin = function(opts) 
    {
    var defaultOptions = {
    showResults: 10
    };
var opts = $.extend({}, defaultOptions,opts);
    $.ajax({
   url: 'http/someurl',
   dataType:'json',
   success:function(data){
   },
   error:function(){
     console.log('error from receving data');
   }
});
    };
....but i dont know how to proceed... Thank you in advance