+ 1
Can i use JavaScript directly to transfer data from HTML page to another or i really need ajax + php?
JavaScript
4 Answers
+ 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.
+ 1
.. in old fashion, you can using Cookies (for not credential data) as alternative
cmiiw :)
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
0
You can use local storage.
localStorage["key"] = data;
In other pages,
data= localStorage["key"];