Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("input.auto").keyup(function() {
- var length = $(this).val().length;
- // check to see if there are more than four characters in the input field
- if (length > 3) {
- //when user enters text, checks and retrieves matche tags
- $("#messages").hide();
- $("#messages").removeClass().addClass('loading').text('loading suggestions').fadeIn();
- var type = $(this).attr('id');
- switch (type) {
- case 'org-name' : var url = "/admin/orgList";
- break;
- case 'org-parent' : var url = "/admin/orgList/parents";
- break;
- case 'agency-name' : var url = "/admin/orgList/agencies";
- break;
- case "comm-name" : var url = "/admin/orgList/comms";
- break;
- case "occ-name" : var url = "/admin/occList";
- }
- //verify entered username
- $.post(url,{ term:$(this).val() } ,function(data) {
- // if no suggestions are returned
- if (data=='No matches') {
- $("#messages").fadeTo(200,0.1,function() {
- $(this).removeClass().addClass('failure').fadeTo(900,1).html(data);
- });
- // if suggestions are returned
- } else {
- $("#messages").removeClass().addClass('success').html(data).animate({height: '250px', opacity:'1'},{queue:false, duration:1500, easing: 'easeOutBounce'});
- }
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement