AJAX not refreshing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ukuser
    New Member
    • Mar 2007
    • 2

    AJAX not refreshing

    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(re c){
    var aR;
    try{
    aR = new XMLHttpRequest( );
    } catch (e){
    try{
    aR = new ActiveXObject(" Msxml2.XMLHTTP" );
    } catch (e) {
    try{
    aR = new ActiveXObject(" Microsoft.XMLHT TP");
    } catch (e){
    alert("Your browser broke!");
    return false;
    }
    }
    }

    aR.onreadystate change = function(){

    if(aR.readyStat e == 4){
    var aD = document.getEle mentById('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(ajaxFun ction(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
  • Ukuser
    New Member
    • Mar 2007
    • 2

    #2
    Ignore me for now - am currently onto it and found why it may have happened!

    Originally posted by Ukuser
    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(re c){
    var aR;
    try{
    aR = new XMLHttpRequest( );
    } catch (e){
    try{
    aR = new ActiveXObject(" Msxml2.XMLHTTP" );
    } catch (e) {
    try{
    aR = new ActiveXObject(" Microsoft.XMLHT TP");
    } catch (e){
    alert("Your browser broke!");
    return false;
    }
    }
    }

    aR.onreadystate change = function(){

    if(aR.readyStat e == 4){
    var aD = document.getEle mentById('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(ajaxFun ction(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

    Comment

    Working...