I am using pjax. It's working completely fine for previous and next link. In the same page I have select2 dropdown which should act same as previous and next link. I tried adding url of selected dropdown to a tag and then trigger the pjax but to no avail.
Any help/suggestions are welcome. I have tried the following. This is for the previous and next button and it's working perfectly fine. new Pjax({ elements: "div.js-Pjax a", selectors: [".nogallery img", ".bannerBottom", ".dropdownSearch", "article.kinaguidenContent"] }) For the change in simple dropdown I used the following but to no avail.
jQuery(document).on("change", "select#kinaguidenCategoryValues", function() {
var val = jQuery(this).find("option:selected").val();
jQuery("a.js-Pjax").attr("href", val);
new Pjax({
elements: "a.js-Pjax[href]", // default is "a[href], form[action]"
selectors: [".nogallery img", ".bannerBottom", ".dropdownSearch", "article.kinaguidenContent"]
})
alert(jQuery("a.js-Pjax").attr("href"));
})
I have changed the code as follow and it's working perfectly.