Hi I also need a PHP function to create the XML document. I need it because it’s the only way I can think of as a way to pass variable from PHP to Javascript. (using AJAX also)
Thanks
Hi I also need a PHP function to create the XML document. I need it because it’s the only way I can think of as a way to pass variable from PHP to Javascript. (using AJAX also)
Thanks
One Comment
You’ve already mentioned AJAX, which essentially is the process of reading XML files from javascript. I have provided a beginners guide to AJAX which should answer your questions. As far as your PHP writing an XML file, you can just use: echo "<xml>"; … etc to build your XML file. When you hit that php file you will just get XML returned.
If you are just trying to get a variable from php -> javascript, without back and forth, you can just include a php line in your javascript, which will get proccessed when you hit the page:
eg:
//This is javascript
var name = "<? echo "Some php variable"; ?>";
Hope this helps
Post a Comment