When I make an ajax call and put the returned HTML (includes a <form> into a <div>...

  • Thread starter Thread starter patabugen
  • Start date Start date
P

patabugen

Guest
...it's all invisible. Why? I have a table and I'd like to replace one of the rows with updated information, each row contains a <Form> for submitting the new data.

I can submit the form fine, and receive the new HTML fine and Firebug reckons it's been put into the <td> properly. But all you see is the existing contents disappearing.

I've tried document.getElementById('id').style.visibility = visible; which I seem to remember I had to do last time I played with ajax a while back - but it doesn't seem to work. Any thoughts?
The problem is not that the object isn't there, it's that it's invisible. IE dosen't update it's local source file with Ajax, and FireBug is saying it's there. Also if I do someObject.innerHMTL = "<form>Hello World</form>"; it is invisible and I cant seem to make the form and it's contents visible!
 
Post the section of code that is updating the table, and we can probably help you better. Or of course point us to a web page, which we can see the AJAX code.

Personally, I remember believing this was true, but I realized that I had to delete the child node and re-add it to get it to work in IE and Firefox. And I found that my AJAX was on the incorrect node when it was trying.

Here's some example code of updating a DIV with the current date/time.
<html>

<HEAD>
<script language="Javascript">

function dateupd() {
//alert(document.getElementById("myText").style.color);
curDate = new Date();
dateStr = "Today is " + curDate.getDay() + "/" + curDate.getMonth() + "/" + curDate.getFullYear();

// NOTE: You can remove this line, since it is only displaying the time in addition to the date
dateStr = dateStr + " " + curDate.getHours() + ":" + curDate.getMinutes() + ":" + curDate.getSeconds();

document.getElementById("myDate").innerHTML = dateStr;
//document.write(colours[index]);
ref2=window.setTimeout("dateupd()",1000);
}
</script>
</HEAD>
<body onload="dateupd();">
<h3 id="myDate" style="text-align: right;">00/00/0000</h3>
</body>
</html>
 
What i would do is check the source code in internet explore or firefox once the update is done.

if the updated data does appear in the source code, it's definetly your CSS somewhere.

Otherwise go back and double check your javascript and ajax call.

hope you get it
 
Back
Top