I'm a PHP programmer but i'm pretty messed up at this moment with the following script.
I have a page with a 'TEXTAREA' and a 'PLAY' text.
when i click PLAY, values are being displayed in the TEXTAREA with a delay of a second.
the values are stored in array, if for example i have an array with the values (2,5,7,8) then it will first show 2, after a second 4 and so on...
the values are being set using PHP, then i convert the php array into JS array so i can execute the script above.
the problem is i need those values to be stored in the database only after
the user has pressed 'PLAY'.
see where the problem is?
I've just started reading about ajax so i don't really know how it works and what i am able to do with it. just sending back the JS array and then executing the query is a bad idea because the values can be easily changed by the client .
i guess i first need to only put the TEXTAREA and the PLAY button.
then when the user press PLAY, i have to run a php code with all the calculations and stuff and only then sending the JS script back to the user.
i am not sure how it works, i know the data you retrieve using AJAX is XML type or something like that. am i able to send a new JS code directly back to the user?
I know the question looks like a big mess with my English, sorry about that...
I have a page with a 'TEXTAREA' and a 'PLAY' text.
when i click PLAY, values are being displayed in the TEXTAREA with a delay of a second.
the values are stored in array, if for example i have an array with the values (2,5,7,8) then it will first show 2, after a second 4 and so on...
the values are being set using PHP, then i convert the php array into JS array so i can execute the script above.
the problem is i need those values to be stored in the database only after
the user has pressed 'PLAY'.
see where the problem is?
I've just started reading about ajax so i don't really know how it works and what i am able to do with it. just sending back the JS array and then executing the query is a bad idea because the values can be easily changed by the client .
i guess i first need to only put the TEXTAREA and the PLAY button.
then when the user press PLAY, i have to run a php code with all the calculations and stuff and only then sending the JS script back to the user.
i am not sure how it works, i know the data you retrieve using AJAX is XML type or something like that. am i able to send a new JS code directly back to the user?
I know the question looks like a big mess with my English, sorry about that...
Comment