View Full Version : Refresh Value from popup page to main page

05-02-2006, 11:53 AM
I created a quick slide show of what I need.

What I'm looking to do is have a page that has a link to add a new value into the database. When you click the link, a small popup will be shown with a textfield asking you for the value. After typing the value and pressing the save button. The popup box will close and the main page will have the value shown without refreshing the page.

How can I achive this? I know you would have to use ajax maybe? Or some type of onload method, though I don't know.

See attachment for clarification. Thanks!

05-02-2006, 11:58 AM
I should note that I know how to do this on one page.



<script language="Javascript">
function xmlhttpPost(strURL) {
var xmlHttpReq = false;
var self = this;

// Mozilla/Safari
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();

// IE
else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");

self.xmlHttpReq.open('POST', strURL, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function() {
if (self.xmlHttpReq.readyState == 4) {


qstr = 'entrytitle='+entrytitle+'&entrytext='+entrytext;

function updatepage(str){
Title: <input id="entrytitle" type="text"><br>
Text: <input id="entrytext" type="text"><br>
<input type="button" value="Submit" onclick="xmlhttpPost('process.php');">

<div id="mydiv"></div>




echo $HTTP_POST_VARS['entrytitle'];
echo $HTTP_POST_VARS['entrytext'];


I just don't know how to display this on the main page from the popup menu.