var opt = $.extend({
jsonOptions :{
value : 'id',
text : 'text',
},
}, options );
return elem.bind("keyup.myPlugin", function () {
$.ajax({
url:'abc.php',
type:'get',
data:{title:$(this).val()},
success:function(data){
var obj = $.parseJSON(data);
if(obj.length){
var ul = '<ul>';
$.each(obj, function(i, item) {
//here I want to access item.DYNAMIC_PROPERTY
//item.(opt.jsonOptions.value) gives error
ul += ' <li data-id="'+item.(opt.jsonOptions.value)+'">';
ul += item.(opt.jsonOptions.text);
ul += ' </li>';
});
ul += ' </ul>';
drp.html(ul);
}else{
drp.html('<div style="text-align:center;">No match found.</span>');
}
}
});
}