Javascript/PHP interaction

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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.

Re: Javascript/PHP interaction

Brad Everman schrieb:
Quoted text here. Click to load it

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:


Site Timeline