Ajax get last data via tag

0 favourites
  • 11 posts
From the Asset Store
Forget about default textbox restrictions, you can create sprites atop of the textbox
  • so I have several files to request (not sure how to request one line from a file).

    How do I use the Ajax.LastData and get a specific tag? I'm horrible at explaining so if you understand this you're a god.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ajax.LastData contains everything the requested page would show.

    You either need to filter from the results, or make sure the relayed results just hold the info you need.

  • How would I filter it? It seems like AJAX is very straight forward and doesn't have alot of options :/

  • Could you explain more specific what you mean with "tag" ?

  • Although this answer is so simple, it almost can't be the answer you are looking for:

    in the request action you can set a "tag"

    in the on completed action you can set that same "tag"..

    so in the ajax on completed with that specific "tag" - you can set the actions for what to do with the data associated with that specific ajax request..

  • Although this answer is so simple, it almost can't be the answer you are looking for:

    in the request action you can set a "tag"

    in the on completed action you can set that same "tag"..

    so in the ajax on completed with that specific "tag" - you can set the actions for what to do with the data associated with that specific ajax request..

    Yeah but it gets more complicated in my case

    I want a text to change to the file requested with AJAX, so if I request several files (with texts in it) it will get confused with what I mean with "GetLast" :/

  • Could you explain more specific what you mean with "tag" ?

    When using the AJAX expression, for example AJAX.GetLast("tagFromRequest") now I know that one doesn't work but if there's any ideas of doing something similiar?

  • > Although this answer is so simple, it almost can't be the answer you are looking for:

    >

    > in the request action you can set a "tag"

    >

    > in the on completed action you can set that same "tag"..

    >

    > so in the ajax on completed with that specific "tag" - you can set the actions for what to do with the data associated with that specific ajax request..

    >

    Yeah but it gets more complicated in my case

    I want a text to change to the file requested with AJAX, so if I request several files (with texts in it) it will get confused with what I mean with "GetLast" :/

    What's more complicated?

    Ajax on completed "tag" - set text to ajax.lastdata

    Ajax on completed "othertag" - set other text to ajax.lastdata

    from the manual:

    LastData

    The contents of the last response. This is set in the On completed trigger. If used in a different event, it contains the response of the last completed request.

  • ...

    How do I use the Ajax.LastData and get a specific tag?....

    Looking closer at this bit ...

    When you perform an Ajax request, and the request is successful, the reply from that request will be available once, and can be caught using the on request complete trigger, referencing the tag you defined in your ajax request.

    After the trigger on request complete has run, the Ajax.LastData will not be available anymore from that request, unless you perform the ajax request again with the same tag.

  • If you want all your data loaded before working with it, you should store each LastData inside a dictionnary, using tags as keys.

  • If you want all your data loaded before working with it, you should store each LastData inside a dictionnary, using tags as keys.

    this sounds interesting and fairly easy, let me test and I'll get back to you

    EDIT: This is exactly what I needed! Thank you!!

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