0

I'm trying to create an image with text on it that people can edit on the same page. But a lot of the information that will be placed on the image is being taken from another source using file_get_contents via PHP. I want user's to be able to click a refresh button to reload the image and data on the image without having to refresh the page. How can I do this using javascript or other language?

Any ideas are welcome, thanks.

pilsetnieks
  • 10,330
  • 12
  • 48
  • 60
Josh Woelfel
  • 1,919
  • 4
  • 17
  • 16

1 Answers1

1

To reload the image you need to use javascript and set the src='imgName2.jpg' where imgName2.jpg is not the old name. Or

src='oldNmae.png?t=" + +new Date() + "'" //check if this works on your webserver

<script>

function change1()
{   


   edit_save.src = "../template/save.png";                              
}
</script>

From Programmatically change the src of an img tag

To reload the text need to use ajax and then change the inner html of some element over the image. (css z order)

Simple ajax sample http://www.degraeve.com/reference/simple-ajax-example.php

For css and innerHtml can google!

Community
  • 1
  • 1
tgkprog
  • 4,493
  • 4
  • 41
  • 70