So, I should send data to PHP script (AJAX, jQuery):
- ['item1','item2','item3']
- action = update
- uid = 'dsfs112'
It should received back:
- ['item2','item3']
- action = update
- uid = 'dsfs112'
PHP will return my changed array
How the better way to do it?
If only thing you want to do is to remove the first element of the array from parameters, just use
array_shift()on the array in PHP.The basic workflow will look like this:
Send this data structure using POST (jQuery’s
.post()will do), eg. like that;On PHP side (within
my_script.phpfile probably):And this should be all –
datawithin your JS success callback should be then of the following structure: