Say I have a box , I want to send a variable from Jscript to PHP
Is it possible by using serialize() ?
| SitePoint Sponsor |




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


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
My project: Open source Q&A
(similar to StackOverflow)
powered by php+MongoDB
Source on github, collaborators welcome!
Yes only way to go from javascript to php is through AJAX unless you are accessing SERIALIZED objects from the database.
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.
what is serialized?? i thought the only way to do it was ajax...
Bookmarks