Jquerymobile filter listview not working when fetching data dynamically
the code for displaying data using url getfilms.php
var xmlhttp = new XMLHttpRequest();
var url = "./getfilms.php";
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
myFunction(xmlhttp.responseText);
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
function myFunction(response) {
var arr = JSON.parse(response);
//var arr = obj.records;
var i;
var out = "";
for (i = 0; i < arr.length; i++) {
out += "<li><a href ='" + arr[i].Path + "'>" + arr[i].Film + "</a></li>";
}
document.getElementById("searchfilmsbyname").innerHTML = out;
}
The code for displaying the listview in html side using id="searchfilmsbyname"
<ul data-role="listview" data-filter="true" data-filter-reveal="true" data-filter-placeholder="Search films..." data-inset="true" id="searchfilmsbyname">
</ul>