I'm trying to render a view using Ajax, but I can't get the ajax pagination to work. I've found the following code which works, apart from the pagination:
$.ajax({
url: '/views/ajax',
type: 'post',
data: {
view_name: 'stores',
view_display_id: 'default',
view_args: {},
},
dataType: 'json',
success: function (response) {
if (response[1] !== undefined) {
$('.store-locator-view-wrap').html(response[1].data);
Drupal.attachBehaviors(); // Thought this would do it, but nope
}
}
});
The links go to /views/ajax?page=1 with the following json:
[{"command":"settings","settings":{"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"rhm_starter","theme_token":"dRce3KwWhWs1ZpnNe6KVUu31mLX8pdVoZ5XixJo8SVI"}},"merge":true}]
::1
Drupal.settings
does not contain aviews
key. Have not discovered anything more past that.