SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
-
Oct 24, 2009, 13:27 #1
- Join Date
- Feb 2005
- Location
- Beyond the seas there is a town
- Posts
- 711
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
send a variable from Jscript to PHP
Say I have a box , I want to send a variable from Jscript to PHP
Is it possible by using serialize() ?I shall build a boat,I shall cast it in the water,
I shall sail away from this strange earth,
Where no one awaken the heroes in the wood of love
-
Oct 24, 2009, 14:31 #2
- Join Date
- Jan 2009
- Location
- Surrey BC, Canada
- Posts
- 309
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
When going from Javascript (A client side language) to PHP (A server side language)
a server call will have to be made. This is typically done using AJAX, which is made incredibly simple using jQuery.
Here's a related sitepoint article: http://articles.sitepoint.com/article/ajax-jquery
-
Oct 24, 2009, 15:50 #3My project: Open source Q&A
(similar to StackOverflow)
powered by php+MongoDB
Source on github, collaborators welcome!
-
Oct 24, 2009, 16:29 #4
- Join Date
- Oct 2009
- Posts
- 20
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yes only way to go from javascript to php is through AJAX unless you are accessing SERIALIZED objects from the database.
-
Oct 26, 2009, 00:35 #5
- Join Date
- Oct 2009
- Posts
- 58
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
One more thing that was not mentioned here, is that by default there is not serialization function in JavaScript.
Although it can be done using JSON.stringify() or some JS framework (if it has such functionality). Ofcourse you will serialize your JavaScript objects to JSON string, which can be decoded back in PHP using json_decode function.
Like guys before me said, string transfer has to be done with AJAX.
-
Oct 27, 2009, 03:04 #6
- Join Date
- Jun 2009
- Posts
- 39
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
what is serialized?? i thought the only way to do it was ajax...
Bookmarks