Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multiple jsonp requests on same page failing with timeout error #31

Open
mandard24 opened this issue Feb 10, 2017 · 1 comment
Open

Comments

@mandard24
Copy link

Hi,

I'm doing multiple jsonp calls from one page to get a set of images for each of the product that will be rendered on the page. Even though I see all the requests return response(status - 200) for each of the jsonp call, I'm only able to get the data for one product only(mostly its the last product on the page).

IMPORTANT: all the jsonp requests uses same callbackto return the content.

I'm using React component to render product list by iterating through an array. Every time a new product list component is called/created, i make the jsonp request to fetch the set of images and display on the page.

When my page renders I see only one of the product shows the list of images. And rest of the jsonp request end up in 'Timeout' error.

Can someone show me how to make these multiple jsonp requests each with the same jsonp callback that simply gets content for each of the product?
console-error
network-requests-success

@alliuca
Copy link

alliuca commented Oct 12, 2017

can you change the callback prefix on each request? that's how I solved my issue. Something like:

jsonp(${url}&callback=${cbPrefix}, { timeout: 1000, prefix: cbPrefix }, (err, data) => {

that cbPrefix is different at each request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants