jQuery mobile list view refresh is not maintaining listview style

Here is my HTML code:

<div>
  <ul id="categories" data-role="listview">
    <li>
      <a href="#">England</a>
    </li>
  </ul>
</div>

And here is my jQuery ajax code:

function doSomething() {
    alert('Do something called');
    $.ajax({
        url: 'Some URL',
        type: 'GET',
        dataType: 'json',
        contentType: 'application/json',
        beforeSend: function () {
            alert("Before send alert");
        },
        complete: function () {
            alert("Service call complete.");

        },
        success: function (strData) {
            var jsonString = JSON.stringify(strData);
            alert("Service call success." + strData['CategoyKey']);

            $.each(strData.GetCategoriesResult, function (key, value) {
                $('#categories').append('<li><a href=\'#\'>' + value.CategoryDescription + '</a></li>');
            });
            alert('Calling refresh');
            $("#categories").listview("refresh");
        },
        error: function () {

            alert(error());
        }
    });
};

I am calling this function on one button click. But i am not able to see listview widget with its style. It looks like a plain list.

Version of jquery JS is jquery-1.11.1.min.js Version of jquery Mobile JS is jquery.mobile-1.4.2.min.js

Can someone help me out here?

Answers


Need Your Help

SAX XML Java Entities problem

java xml sax

I've a problem with SAX and Java.

XSLT sorting - how to sort AND copy the whole input as sorted output

xml sorting xslt xpath xslt-grouping

I am trying to sort an XML file using XSLT transformation, but it doesn't do what I want. I want to sort the XML lexicographically by the loc element.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.