Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Need to refresh/reload a div after form submission

Posted on 2012-04-12
5
Medium Priority
?
1,478 Views
Last Modified: 2012-04-16
Hi,

I thought this was a extremely simple question, but ik can't find the answer...
After my php form is submitted, it echoes: "form submitted"

When this message shows, i would a specific div to de reloaded / refreshed. because it contains a picture that could be renewed by the form.

How can i make this specific div refresh?

Thanks
0
Comment
Question by:peps03
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 37838476
>After my php form is submitted, it echoes: "form submitted"

what about :

After my php form is submitted, it echoes: "form submitted<div style='display:none'><img src='images/'" . $img_fullpath . "' /></div>"

echo "form submitted<div id='myimage' style='display:none'><img src='images/'" . $img_fullpath . "' /></div>";

Open in new window


to show it :

to refresh your div :

document.getElementById("your_div_ID").innerHTML = document.getElementById("myimage").innerHTML;

Open in new window

0
 
LVL 20

Expert Comment

by:Proculopsis
ID: 37838482
You need to use an ajax post, as in this jsfiddle.

    $.ajax({
        url: "/echo/html/",
        data: data,
        type: "POST",
        success: success
    });



function success(response) {
    $("#result").text("Form returned: " + response);
}

Open in new window

0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 37838514
Strange... how do you submit your form without losing focus on the page? Do you use an AJAX call to make the submission and load the message when it's returned?

What's the content on the div and how do you load it on the normal flow of the page?
0
 
LVL 8

Expert Comment

by:X-treem
ID: 37838580
if you are using (i)frames you can echo a javascript to change the source of a picture instead of just "form submitted"
if using ajax, you can do this as well, but you need to parse the result (to execute the javascript)
0
 

Author Closing Comment

by:peps03
ID: 37850723
Works great leakim971!!!
Thanks again!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question