473,390 Members | 1,438 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,390 software developers and data experts.

Updating area

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
2 1624
On 29 Mar, 14:07, "UKuser" <spiderc...@yahoo.co.ukwrote:
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
firstly use POST when changing the state of the app/database, (or for
instance all your links could all be prefetched, killing the entire
thing)

secondly, if you are not already using firebug in firefox, install it,
you can watch your XHR calls in real time, and debug everything to do
with ajax easily. Using a proxy would also help, so get fiddlertool or
paros. This will help YOU see exactly what's going on without needing
any help from anyone, trust me.

Mar 29 '07 #2
On 29 Mar, 14:49, "shimmyshack" <matt.fa...@gmail.comwrote:
On 29 Mar, 14:07, "UKuser" <spiderc...@yahoo.co.ukwrote:
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

firstly use POST when changing the state of the app/database, (or for
instance all your links could all be prefetched, killing the entire
thing)

secondly, if you are not already using firebug in firefox, install it,
you can watch your XHR calls in real time, and debug everything to do
with ajax easily. Using a proxy would also help, so get fiddlertool or
paros. This will help YOU see exactly what's going on without needing
any help from anyone, trust me.
Firebug is excellent and well worth downloading. Good advice and
helped fix my code!

Mar 29 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: dave | last post by:
Hello, I've got a page, actually a friend does, that he'd like to update with his schedule for the week. THis is a simple html page, and he'd like to do this via a php script. Ideally one would...
3
by: Basil Fenix | last post by:
Hi, I have a long process where I use a progressbar and update the caption of the form with the % complete.The problem is that the caption in the taskbar does not get updated. I can get it done...
3
by: Steve Lamb | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ok, this one I did try before coming here... :) I am trying to report the status of what is going on to the status bar of the main window of my...
14
by: WindAndWaves | last post by:
Hi Gurus I have been working on a rather sophisticated update procedure for FEs of my application that are spread throughout the country. Now, I recently thought: WHAT IF I identify all the...
14
by: el_sid | last post by:
Our developers have experienced a problem with updating Web References in Visual Studio.NET 2003. Normally, when a web service class (.asmx) is created, updating the Web Reference will...
3
by: Grant | last post by:
I need some sample code showing how to manipulate data in my access database using C#. This is what Im trying to do: Dropdownlist with datagrid both bound to datasource. When the drop down list...
3
by: RSH | last post by:
Hi, I have a situation in where i have two instances of SQL server, the first is our Production Environment, the second is our Development environment. Both servers contain the same databases...
6
by: karelor | last post by:
here is the code: -------------------------------------------------------------------- set mySql = oConn.Execute("update personal_D set firstname='"&firstname&"', lastname='"&lastname&"', " &_...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.