SHARE
TWEET

Untitled

a guest Sep 15th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function(){
  2.   $('#<portlet:namespace/>country').on('keydown keyup',function(){
  3.     var data = [];
  4.     var text = $(this).val();
  5.  
  6.     $('#<portlet:namespace/>country').autocomplete({
  7.       source: function(request,response){
  8.         Liferay.Service('/country/get-countries', {
  9.           active: true
  10.         },
  11.         function(obj) {
  12.           for(let i =0;i<obj.length;i++){
  13.             if(obj[i].name.indexOf(text) != -1){
  14.               data.push(obj[i].name);      
  15.             }
  16.           }
  17.           response(data);
  18.         });
  19.       }
  20.     })
  21.   });
  22. })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top