SHARE
TWEET

Untitled

a guest Jun 15th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery("#kd_nr_search").autocomplete({
  2.   minLength: 2,
  3.   source: function (term, response) {
  4.           jQuery.post({
  5.               url:ttstickerz_object.ajax_url,
  6.               data: {
  7.                search: term,
  8.                action: 'search_kunden_nr'
  9.               },
  10.               method: "POST",
  11.               dataType: 'json',
  12.               success: function (data) {
  13.                 response( jQuery.map( data.kunden, function( item ) {
  14.                   jQuery.each(item,function(i,val) {
  15.                      val.label = item.name;
  16.                   });
  17.                   return item;
  18.                 }));
  19.               },
  20.               select: function(event, ui) {
  21.                 alert(ui.name);
  22.                 return false;
  23.               }
  24.           });
  25.           }
  26.       }).data("ui-autocomplete")._renderItem = function( ul, item ) {
  27.   return jQuery( "<li>" )
  28.     .append( "<a>" + item.name + "<br></a>" )
  29.     .appendTo( ul );
  30. };
  31.      
  32. success: function (data) {
  33.                 alert(data);
  34.                 response( jQuery.map( data.kunden, function( item ) {
  35.                   jQuery.each(item,function(i,val) {
  36.                      val.label = item.name;
  37.                   });
  38.                   return item;
  39.                 }));
  40.               }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top