Web programming makes me want to cry.. (Images/ Ajax/ JS)

Bes

Bes

Soldato
Joined
18 Oct 2002
Posts
7,318
Location
Melbourne
Hi

I am trying to get an image to refresh on its own (and not touch the rest of the page) on a button being pressed, the catch is that the image also needs to pass the contents of a form to a MagickWand back- end script for processing but for the life of me, I cannot get it to work unless I refresh the whole page using PHP. The image is actually a PHP page passing some arguments...

I have two approaches in mind:

1) Ajax, However I cannot figure out how to do this using Ajax and cannot find anything that useful to go off....

2) Javascript.

Using this code

PHP:
function refreshimage(){
document.getElementById('test').src = document.getElementById('test').src + '#';
   }

I can get the image to reload on button press, but I cannot work out how to pass the contents of the active form to it (I know how I might do it, get javascript to read the values of the form, then drop those values into the image URL), but I can't work out how to drop the values into the URL
 
Hmm to be honedt I don't think I understand the code well enough... I am refetching element test with a hash on the end (To prevent caching), which works, but I cannot figure out how to get my variables in there, i.e. in my HTML I have this:

Code:
<img id='test'src="imagick_working.php?htmlFormPrimaryChop='What goes here??'">

I have tried all sorts in the WHAT GOES HERE section but to no avail... i.e. I am trying to read values from my form in the javascript (which works), then write them back in as part of the image HREF.

help :(
 
Back
Top Bottom