Re: Javascript/PHP interaction
- From: Christoph Burschka <christoph.burschka@xxxxxxxxxxxxxx>
- Date: Tue, 12 Dec 2006 09:27:14 +0100
Brad Everman schrieb:
Suppose I have a bunch of DOM objects (namely images) and want to pass the attributes of these DOM objects to a PHP script. What is the easiest way to accomplish this? Basically, I have a bunch of images that can be manipulated by Javascript and want to determine their final locations after the user is done moving them. For instance, one of the attitbutes might be dd.elements.circle1.h, where h is the height of the image named circle1. This height is set when the page is loaded, but may change as the user manipulates the circle. Would I be better off just writing a bunch of form data then passing this to PHP? I vaguely remember seeing something about manipulating session variables with Javacript.
Thanks for any help.
Communicating between Javascript and the server is best done with an XMLHttpRequest. Essentially, the script makes a call back to the server (probably using POST, in your case, and sending the data manipulated by the user), the server processes it and then returns a response that the script can parse.
Note that even though it's called "XML", the request and response don't need to be formatted as XML, which can save a lot of time if you haven't worked with XML document definitions before.
This is somewhat helpful: http://en.wikipedia.org/wiki/XMLHttpRequest
--
CB
.
- References:
- Javascript/PHP interaction
- From: Brad Everman
- Javascript/PHP interaction
- Prev by Date: Re: faster way to get from SQL database into array
- Next by Date: Re: faster way to get from SQL database into array
- Previous by thread: Javascript/PHP interaction
- Next by thread: Concat in a join?
- Index(es):
Relevant Pages
|