473,241 Members | 1,616 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,241 software developers and data experts.

AJAX not refreshing

2
Hi Folks,

I havent used javascript in ages, and am not the worlds guru, but I'm
playing with ajax linking to my database and an updating area.

I have an area named display for example which lists each entry (from
a PHP/MySQL db) with a remove button at the end of each record which
feeds a unique ID to my ajaxfunction below:

function ajaxFunction(rec){
var aR;
try{
aR = new XMLHttpRequest();
} catch (e){
try{
aR = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
aR = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
alert("Your browser broke!");
return false;
}
}
}

aR.onreadystatechange = function(){

if(aR.readyState == 4){
var aD = document.getElementById('test').innerHTML =
aR.responseText;
}
}

aR.open("GET", "delete.php?del="+rec+"&sid="+Math.random(), true);
aR.send(null);

}

My problem is that although delete.php correctly displays the updated
list of entries (the first time), if I reclick Remove (which is re-
displayed by delete.php) whatever I have tried does not update the
list again (although it does remove the record from the db). Its like
the function needs resetting.

I sometimes get told to be clear - so I'll retry just in case

> php - > get data & display as rows in display area

(field - field - Remove button onclick(ajaxFunction(unique ID)) -
etc etc

> <display area> </da>

delete.php deletes the row and redisplays the php data into the
display area. It redisplays the options with a delete button but when
clicked - although the data IS removed from the DB the display area
does not refresh with the new updated data.

I hope that makes sense, and any help would be great. I'm tempted to
give up and just use static old PHP .... never fails.

Thanks

A
Mar 29 '07 #1
1 1834
Ukuser
2
Ignore me for now - am currently onto it and found why it may have happened!

Hi Folks,

I havent used javascript in ages, and am not the worlds guru, but I'm
playing with ajax linking to my database and an updating area.

I have an area named display for example which lists each entry (from
a PHP/MySQL db) with a remove button at the end of each record which
feeds a unique ID to my ajaxfunction below:

function ajaxFunction(rec){
var aR;
try{
aR = new XMLHttpRequest();
} catch (e){
try{
aR = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try{
aR = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
alert("Your browser broke!");
return false;
}
}
}

aR.onreadystatechange = function(){

if(aR.readyState == 4){
var aD = document.getElementById('test').innerHTML =
aR.responseText;
}
}

aR.open("GET", "delete.php?del="+rec+"&sid="+Math.random(), true);
aR.send(null);

}

My problem is that although delete.php correctly displays the updated
list of entries (the first time), if I reclick Remove (which is re-
displayed by delete.php) whatever I have tried does not update the
list again (although it does remove the record from the db). Its like
the function needs resetting.

I sometimes get told to be clear - so I'll retry just in case

> php - > get data & display as rows in display area

(field - field - Remove button onclick(ajaxFunction(unique ID)) -
etc etc

> <display area> </da>

delete.php deletes the row and redisplays the php data into the
display area. It redisplays the options with a delete button but when
clicked - although the data IS removed from the DB the display area
does not refresh with the new updated data.

I hope that makes sense, and any help would be great. I'm tempted to
give up and just use static old PHP .... never fails.

Thanks

A
Mar 29 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: k.mitz | last post by:
Hi, I have a PHP application that allows users to generate a .pdf report of their database content. Normally, I've had to refresh a page to call the script to generate the report, so there's a...
21
by: javainfo | last post by:
How can i refresh IFRAME and load data through AJAX?
0
by: arunprabu | last post by:
Hi, I have a problecm with the AJAX request in my webpage. I have some filters on top of the page. I have a submit button and an empty div below the filters. Some of the filters have ajax...
3
by: user | last post by:
Hi, let's say a page loads on a browser. Without refreshing the page, multiple textboxes within the page gets real time data @ a few seconds interval. what is the logic behind to achieve...
1
by: santhubaba | last post by:
Hi All, I am facing a problem with ajax in dotnet(c#) page My problem is as follows: There is a grid with many buttons , one of the buttons is "Upload" ,if i click on that upload then...
4
by: =?Utf-8?B?VW1lc2huYXRo?= | last post by:
I have a web application, it is running and have control (.NET control /Activex) which has to capture data from other application probably windows application. The data send by the windows...
25
by: Piotr Nowak | last post by:
Hi, Say i have a server process which listens for some changes in database. When a change occurs i want to refresh my page in browser by notyfinig it. I do not want to refresh my page i.e....
21
by: Leena P | last post by:
i want to basically take some information for the product and let the user enter the the material required to make this product 1.first page test.php which takes product code and displays...
3
by: burrashiva | last post by:
:( ::) Hello there, I recently started Web Designing with PHP, Javascript and AJAX. I am facing a problem which I will try to explain: If I am successful in conveying the problem to you...
7
by: raknin | last post by:
I'm using AJAX on my website, but internet explorer does not seem to actually be refreshing the data I retrieve via AJAX when I refresh the page. For example, I have a button that when pressed uses...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.