Use very basic URL routing to determine postId/query in AJAX instead of data attributes.
Same URL routing applied to queries.