473,403 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Javascript/PHP interaction


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.
Dec 12 '06 #1
1 1480
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
Dec 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

41
by: Mr. x | last post by:
Hello, Can I make my java script code be invisible to other people who enter into my site by IE browser ? - How ? Thanks :)
53
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
6
by: KKramsch | last post by:
OK, here's the scenario: I have a CGI script that generates a page with frames (BTW, I'm not crazy about frames, but in this case the decision to use them is out of my hands). In a typical...
8
by: Chris Markle | last post by:
When JavaScript writes out a dialogue box (like when confirm() is called) the header or title of that dialogue box shows up as "JavaScript Application"... Can this title be changed so that maybe...
21
by: strutsng | last post by:
<input type="file"> only allows the user to browse for files. How about "browse for folder" dialog? Can html/javascript do that? I couldn't find any syntax for that. If not, please advise what...
0
by: David Virgil Hobbs | last post by:
While studying the asp.net javascript problem I saw and used pages about asp.net basics at http://www.sitepoint.com/article/815/4 and...
10
by: jason_box | last post by:
Hello, I was wondering if there was a way to have a javacript be activated by an input button that would call to a cgi program and querey every 10minutes and the cgi would update the page without...
1
by: seejay1982 | last post by:
Hi, I am writing an application where I create a temporary file on the client machine and I have to upload this file to a CGI on the server. This needs to be done without the user interaction. ...
2
by: humberto.bortolossi | last post by:
Greetings! I'm trying to control Java Applets using JavaScript. However, the standard recipes don't work under XHTML (they work well within HTML). See, for instance, the code ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.