ajax - bootstrap select2 results won't show on return -
i'm trying use bootstrap select2(ajax) in custom joomla component don not data listed on return. javscript looks follows
jquery("#e6").select2({ placeholder: "plz // bundesland // ort angeben", minimuminputlength: 2, ajax: { url: "index.php?option=com_tieraerzte&task=tieraerzt.locator&tmpl=component", datatype: 'json', data: function(term, page) { return { q: term, // search term }; }, results: function(data, page) { return {results: data}; } }, formatresult: function(data) { //shows undefined on return alert(data.plz); return "<div class='select2-user-result'>" + data.plz + "</div>"; }, formatselection: function(data) { return data.plz; } });
snipet of returned json data
[[{"plz":"10247","kiez":"friedrichshain-kreuzberg","ort":"berlin","bundesland":"berlin"}]]
Comments
Post a Comment