How do you distinguish between data sent from multiple datatables on the same page in a post back?
How do you distinguish between data sent from multiple datatables on the same page in a post back?
I have two datatables, on the same html page, that post to the same node.js server page. When I create a record in either of the tables how can I detect in my server page which table has posted the data? It appears that the array that is sent doesn't contain that information:
action=create
data[0][first_name]=Ted
data[0][last_name]=Hughs
data[0][position]=CEO
data[0][office]=London
data[0][extn]=3456
data[0][start_date]=2016-02-12
data[0][salary]=100000
Is it a case of you have to post to different server pages?
This question has an accepted answers - jump to answer
Answers
I have used two distinguishing post back urls to process the data from each table:
ajax: "/budget/facility"
ajax: "/budget/staff"
So I can use the same server page and this now works.
That's generally how I would recommend you do it. Another way is to add a GET parameter to the URL, or use
ajax.data
to add an identifying parameter if you are using POST requests.Allan