Jump to content

innHTML not working with ajax?


ZeroShade

Recommended Posts

I'm having a problem calling a second function. Its not putting the text in the div... it instead just says "[object]". Any ideas?

function changeDescription(desc)		{			if (xmlHttpRequestObject)			{				var descObj = document.getElementById("objDesc");								xmlHttpRequestObject.open("GET", desc);								xmlHttpRequestObject.onreadystatechange = function()				{					if(xmlHttpRequestObject.readyState == 4 && xmlHttpRequestObject.status == 200)					{						// The state is complete and the status is successful.					}				}								descObj.innerHTML = objDesc;			}			else			{				alert("Your browser does not support AJAX!");				window.location="Default.aspx";			}		}	</script>	<div style="background-image:url('img/Header.png'); background-repeat:no-repeat; height:50px; 		font-family:Verdana; text-align:center; font-size:medium; font-weight:bold; ">		<br />Photos	</div>	<center>		<asp:Panel ID="ImageViewPanel" runat="server" Height="400px" Width="600px" BorderColor="white" BorderWidth="5px">			<asp:FormView ID="ImageFormView" runat="server" DataSourceID="ImageObjectDataSource" DataKeyNames="ImageId">				<ItemTemplate>					<img src='album/<%# Eval("ImageName") %>' id="ViewImage" alt="" height="400px" width="600px" />					<div id="objDesc"><%# Eval("ImageDescription") %></div>				</ItemTemplate>

Link to comment
Share on other sites

Well then you will have to reference its content using the innerHTML property.

descObj.innerHTML = document.getElementById('objDesc').innerHTML;

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...