这是我使用的代码......您只需使用自己的代码添加 href 标记:
$( document ).on( "pageinit", "#myPage", function() {
$( "#autocomplete" ).on( "listviewbeforefilter", function ( e, data ) {
var $ul = $( this ),
$input = $( data.input ),
value = $input.val(),
html = "";
$ul.html( "" );
if ( value && value.length > 2 ) {
$ul.html( "<li><div class='ui-loader'><span class='ui-icon ui-icon-loading'></span></div></li>" );
$ul.listview( "refresh" );
$.ajax({
url: "http://ws.geonames.org/searchJSON",
dataType: "jsonp",
crossDomain: true,
data: {
featureClass: "P",
style: "full",
maxRows: 12,
lang: "it",
name_startsWith: $input.val()
}
})
.then( function ( response ) {
$.each( response.geonames, function ( i, val ) {
html += "<li>" + val.name + (val.adminName1 ? ", " + val.adminName1 : "") + ", " + val.countryName + "</li>";
});
$ul.html( html );
$ul.listview( "refresh" );
$ul.trigger( "updatelayout");
});
}
});
});