Appending a List - No Styling - Can Anyone Help.
Hi, I am trying to create my first Web App but have stumbled onto the following problem. I want to append a list via an AJAX call but when I append the list no styling is applied to it.
- <div id="resultLog"></div>
- <ul data-role="listview" id="sample" data-inset="true" data-theme="a">
- <li id="history"><a href="history.html">History</a></li>
- </ul>
- </div>
And below is the AJAX call.
- <script>
- $(function() {
-
- $("#callAjax").click(function() {
- var theName = $.trim($("#theName").val());
-
- if(theName.length > 0)
- {
- $.ajax({
- type: "POST",
- url: "http://localhost:8888/speedway_app/callajax.php",
- data: ({name: theName}),
- cache: false,
- dataType: "data",
- success: onSuccess
- });
- }
- });
-
- $("#resultLog").ajaxError(function(event, request, settings, exception) {
- $("#resultLog").html("Error Calling: " + settings.url + "<br />HTPP Code: " + request.status);
- });
-
- function onSuccess(data)
- {
- $("#resultLog").html("Result: " + data);
- $("#resultLog").append('<li id="james"><a href="asda.html?">Asda</a></li>');
- }
-
- });
- </script>
Many thanks in advance.
Paul.