Josh Woelfel
Josh Woelfel

Reputation: 1969

Reloading data using javascript

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.

Upvotes: 0

Views: 87

Answers (1)

tgkprog
tgkprog

Reputation: 4598

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!

Upvotes: 1

Related Questions