Sourabh Upadhyay Sourabh Upadhyay - 1 month ago 21
Ajax Question

How to catch pagination element of shopify api with jquery

enter image description here

How to enable any of the

pagination
button by clicking on my
ajax
request.

Scenario: In my shopify app, I have a checkbox on which I am sending a
ajax
request and in response I want to enable this button.

Tried: I have tried some solutions mentioned in stackoverflow but couldn't work.

Here:
window.parent.document
this raise error for
permission denied
.

Answer

You can call the same code of shopify pagination in the ajax response. So it will take your changed pagination value and enable the pagination buttons.

ShopifyApp.ready(function(){
  ShopifyApp.Bar.initialize({
    title: window.mainPageTitle,
    icon: '/icon20x20.png',

    pagination: {
      previous: {href: "/start?page=1"},
      next: {href: "/start?page=3"}
    }
  });
});
Comments