views:

72

answers:

2

hello, I wonder if it is possible to refresh a div tag in javascript?

My ajax script

<script type="text/javascript">
function actualiserDLIS()
{
 var url = 'administration/gestionUtilisateurs.do?method=actualisationDLIs';
 var params =  'DR='+encodeURIComponent(document.getElementById('selectDR').value);
    var myAjax = new Ajax.Request(
            url, 
            {   method: 'post',
             parameters: params,
                onComplete: majDLIS
            });
}

function majDLIS(retour)
{
 if (retour.status == 200)
    {
  document.getElementById('tableDLI').outerHTML = retour.responseText;
    }else
 {
      document.getElementById('tableDLI').innerHTML = "uncool";
    }
}
</script>

My html body

<h2 class="surlignageHaut">Restriction d'accés aux données</h2>
<label for="selectDR" >DR de l'utilisateur</label>
<html:select property="utilisateur.DR" size="1"  styleId="selectDR"  styleClass="saisie" style="position:relative;top:2px;left:5px;" onchange="actualiserDLIS();">
 <html:optionsCollection  property="optionsDRS" label="libelle" value="code"/>   
</html:select>
<br/>
<br/>
<div id="tableDLI">
</div>
</div

when i select a data in my list, i do my ajax request and i have a table, when I reselect a different value in my list, my table does not update

A: 

for sure! by using ajax you can load content into your DIV-tags, as well as into many other DOM-Elements live.

helle
A: 

Hello Mercer,

Use the name of function which you describe inside the div.

Function to call the method : window.setTimeout("name_of_the_function_present_in_div()",30000);

Here 30000 show 30 seconds, now you can modify the contents according to you requirement. I hope this work for you..

All the Best !!!

Rahul Patil
Hello Rahul Patil, i don't understand what you want do ??
Mercer