Dynamic List not displayng JQM style, tried several fixes to no avail...
Hi, I have tried a ton of solutions and am in the hair pulling stage, if anyone can help it would be deeply appreciated... TIA. :)
I am attempting to display the contents of a JSON array in my HTML with proper styling in place. Here is the JSON array I am loading:
http://highendwholesale.com/json.php
Here is the result I get when using the code below, as you can see it loads fine but without styling -- if anyone can help me get this working I would be grateful:
http://highendwholesale.com/test.php
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$.ajaxSetup({ cache: false });
$.getJSON("json.php", function(data){
var html = [];
html.push("<ul data-role='listview' id='myInventory' data-inset='true'>");
$.each(data, function(index, d){
html.push("<li><a href='#'><img src='http://highendwholesale.com/listings/",d.CID,"/thumb/1.jpg' height='80' width='80' alt='",d.CID,"' />",
"<h2>",d.title,"</h2>",
"<p>",d.blurb,"</p></a></li>");
});
html.push("</ul>");
$("#inventory").html(html.join(''));
$('ul#myInventory').trigger("create");
$('ul#myInventory').listview('refresh');
}).error(function(jqXHR, textStatus, errorThrown){
alert("error occurred!");
});
});
</script>
</head>
<body>
<div data-role="page" id="index" data-theme="d">
<div data-role="header">
<h1>Inventory</h1>
</div><!-- /header -->
<div data-role="content">
<div id="inventory" role="listview"></div>
</div><!-- /content -->
</div>
</body>
</html>