テキスト (item.name) をクリックして、この *on_search* 関数を呼び出すにはどうすればよいですか?
$.each(docs, function(i, item) {
$('#body').append($('<div><a href="">' + item.name </a></div><br/>'));
});
// call this function whenever user clicks the text
function on_search() {
var url ='http:myhomepage/select/?wt=json&json.wrf=?&q='+item.name;
$.getJSON(url, on_text);
}