jquery - How to keep track of multiple request data from the same user in PHP sessions? -


so question little complicated, let me explain. page code running this:

  1. user enters query in search field , clicks submit.

    1.1 jquery loads new body display progress data.

    1.2 jquery calls process.php via ajax , supplies query argument.

    1.3 jquery starts setinterval periodic update grab progress data, stored inside $_session['prog'], , displays it.

  2. when process.php finishes, jquery stops periodic update, displays final information , calls ajax clear $_session['prog'] variable.

at moment progress data stored inside 1 variable, fine far different users concerned (because of different sessions), if same user make multiple requests @ same time, $_session['prog'] variable cross-overwritten.

so far have thought of 2 possiblities distinguish data each request same user (same session)

  1. have jquery generate random string , send query (and hope avoid colission, although unlikely)

  2. make 2 ajax calls, first 1 requesting new_request_id, second 1 sending query , new_request_id parameters.

  3. have ajax return php before finishes(completes).

i need connect each browser window (each request) each running process, cannot send new request id after request has been submitted, because wont know data pick jquery in browser window. btw, change $_session['prog'] $_session[request_id] -> request_id i'm looking for.

it (request_id) last_insert_id(), because im creating new db entries each valid query, don't know how each different user window.

i need advice here. begun code in php, ajax , jquery, don't know sessions. how should solve problem?

sorry lack of code, paste @ request.

you add unique id each request in addition session id. eg. uniqid() in javascript/jquery?


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -