Dynamic AJAX requests (N number of requests)

0 favourites
  • 6 posts
From the Asset Store
Jump on numbers in the proper order and reach the sun!
  • Having used C3 for many client projects using backend server side services I thought this was just another trivial project, turns out not.

    Basically, the start of the layout first requests a number from the server, this number could be anything but likely to be anywhere from 1 to 20 (it also returns this many ID's). The number/count and ID's are stored and then used to do the number of AJAX requests on a regular basis (5 seconds), each request is to get data based on the ID's

    The problem to solve is, how can I do multiple ajax requests (which varies at runtime) and then track each return?

    I cant hardcode each "on complete" because there might be more or less than what is hardcoded.

    Any ideas?

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Use the ajax.tag expression with the on any completed trigger to identify the tag/id of the request it was sent in response from.

  • Without checking, are you suggesting that i can set the request tags dynamically, then use the on any complete and retrieve the tag using Ajax.tag?

    That could work if that’s what you’re suggesting.

  • Correct. I'm assuming you'll be using your IDs as the tag, as they are already unique and supposed to be associated with the data requested.

  • Yes I will, the returned data doesn’t contain the ID but that shouldn’t matter, as long as I can track the result of each request.

    Will give it a go.

    Thanks

  • Worked a treat, many thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)