Цель: Загружать содержимое HTML через $.ajax
, вставлять его в DOM, использовать jQuery Mobile для использования стилей темы.
Проблема: Содержимое вставлено, но отсутствует jQuery Mobile theming.
Код:
$.ajax({
...
success: function(html) {
$('#container').append(html);
$('#page').page('refresh', true);
}
});
В HTML возвращается теги data-role
, которые jQM должен стилизовать...
<a data-role="button">Do Something</a>
Вместо применения стилей, как и должно, я получаю следующую ошибку:
исключение uncaught: нет такого метода 'refresh' для экземпляра виджета страницы
Выше кода с использованием http://code.jquery.com/mobile/latest/jquery.mobile.js
Аналогичные вопросы, которые привели меня к указанному выше сообщению об ошибке:
Последовательно обновлять страницу с помощью соответствующих стилей jQuery Mobile
JQM (jQueryMobile) Динамически добавленные элементы не отображаются правильно, а CSS не применяется