+ 1

Can i use JavaScript directly to transfer data from HTML page to another or i really need ajax + php?

JavaScript

5th Apr 2017, 2:26 AM
anas elbouziyani
anas elbouziyani - avatar
4 Respuestas
+ 3
If you don't really want the fresh data from server you don't need to include Ajax. To transfer the local data you can have : 1) Global variable accessible in any html page. 2) Use local/session storage. 3) Set global and singleton functions with getter and setters.
5th Apr 2017, 2:47 AM
Ashwani Kumar
Ashwani Kumar - avatar
+ 1
.. in old fashion, you can using Cookies (for not credential data) as alternative cmiiw :)
5th Apr 2017, 3:19 AM
cahya dwiana sn
cahya dwiana sn - avatar
0
IMHO, in another case, when you using javascript as server side language too(eg. using node.js), you "can" do that with javascript. But if you using javascript for client side only, and you need to transfer data from the HTML page to the other, than you need using form submit mechanism or AJaX. This is situational case, depend on your case and your need cmiiw
5th Apr 2017, 3:05 AM
cahya dwiana sn
cahya dwiana sn - avatar
0
You can use local storage. localStorage["key"] = data; In other pages, data= localStorage["key"];
5th Apr 2017, 3:11 AM
Calviղ
Calviղ - avatar