0
I have a program where it creates cookies with the data that the user typed in the fields <input>
. All this through AJAX. So far without problems, but in this file where I make the request, it returns me the data of the cookies created. What I want is to take this data and put it in two other fields <input>
.
An example to clarify:
Two camps
<input>
name and email;I send this data to another file that creates cookies with this data;
And two other fields I want to auto-fill with these cookies returned;
Only when returned, they come together, there is some array
to take this information one at a time?
A detail, using pure Javascript, nothing jQuery.
With what pattern do you join, for example, the name with the email? For example:
v_nome + ";" + v_email
.– Rui Pimentel
I’m sorry I didn’t understand your question
– Meeeefiu
You said that the values of the fields, in your theoretical example, are saved in a cookie, but "when returned, they come together". In what way did you save them together? In other words, how did you serialize the data?
– Rui Pimentel
I simply print the cookie on the screen before returning. E.g.: echo $_COOKIE['name']; echo $_COOKIE['email'];
– Meeeefiu
Ah, I get it, the data will stop in particular cookies :) But if you’ve already separated the wheat from the chaff, what’s the problem?
– Rui Pimentel
Yes, but when I use the responseText function, it returns me these two values with a single string, so you want to know how to first send the echo $_COOKIE['name']; and then the echo $_COOKIE['email'];
– Meeeefiu
@Math, instead of putting that kind of detail in the comments, is better [Edit] the question to include them.
– brasofilo