Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $( "#user" ).autocomplete({
- source: function( request, response ) {
- $.ajax({
- url: "{{routes.url_to('users', 'autocomplete')}}",
- type: 'post',
- dataType: "json",
- data: {
- format: "json",
- name_startsWith: request.term
- },
- success: function(data) {
- console.log(data);
- }
- });
- },
- minLength: 2,
- select: function( event, ui ) {
- $('#input_user').val(ui.item.value);
- },
- open: function() {
- $( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
- },
- close: function() {
- $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
- }
- });
Add Comment
Please, Sign In to add comment