フォームの選択フィールドに ajax-chosen を使用しています。
$('#importers_tag').ajaxChosen(
{
dataType : 'json',
type : 'POST',
url : site_url + '/dashboard/load_products'
},
{
generateUrl : function(q) {
return site_url + '/dashboard/load_products/'
+ encodeURIComponent($('#importers_tag').val()) //dynamic url to avoid duplicate in result
},
loadingImg : baseUrl
+ '/resources/js/plugins/chosen/loading.gif'
});
ajaxリクエストでの私のクエリは、次のクエリによるものです
$query = $this->db->query('select * from product where product_id not in ('.$not_in.') and product_name like "%'.$q.'%"');
しかし、ajax で選択された選択オプションは、「product_name like '$q%'」を生成します
両側でワイルドカードによる選択結果を出したい。