Page 1 of 1

AJAX innerHTML and image not displaying

Posted: Thu Nov 17, 2005 12:44 am
by snowDeveloper
Hello,

I am having a problem with setting a div with innerHTML,
using AJAX and your basic php backend.

The problem is when I make a AJAX request the image is
not displayed. After setting the innerHTML.

Examples can be seen at:

http://usatoday.snocountry.com/displayi ... ode=303007
http://usatoday.snocountry.com/displayi ... snowreport

If you click 'snow report' or 'resort info' at the top you will see the transition
but the images do not show up.

Has anyone encountered this? I am imagine it is a simple fix, with the problem
induced by late night coding...

Thanks in Advance

Michael
http://www.snocountry.org

Posted: Thu Nov 17, 2005 1:13 am
by RobertGonzalez
In your links, their appears to be unparsed php vars ($permcode):

Code: Select all

<div id="primarySnoNav">
      <b><a class="snoLink" href="#" onclick="javascript:processLinkUI('resortinfo|{$permcode}'); return false;"><font face="Arial" size="2" color="#0099FF"> resort</font> <font face="Arial" size="2" color="#666666"> info</font> </a> </b>
      &#9474;

      <b><a class="snoLink" href="#" onclick="javascript:processLinkUI('snowreport|{$permcode}'); return false;"> <font face="Arial" size="2" color="#0099FF">snow</font> <font face="Arial" size="2" color="#666666">  conditions </font></a> </b>
      &#9474;
These are the two links that you are having problems with, correct? Maybe look at the script that is outputing this to see why these vars are echoing out as vars rather than the var value.

Posted: Thu Nov 17, 2005 1:47 am
by n00b Saibot
I have a hunch he put them in single quotes :)

Problem fixed...

Posted: Thu Nov 17, 2005 8:48 am
by snowDeveloper
Thanks,

Your posts were correct and lead me down
the path to a couple other such errors.

I know coding after 11:00pm is not a good
idea....

Michael
http://www.snocountry.org

Posted: Fri Nov 18, 2005 2:27 pm
by wtf
innerHTML will overwrite everything that already included in that block

Code: Select all

<div id="ha"><img src="what.jpg"></div>


ha.innerHTML = "some text";


<div id="ha">some text</div>
could that be your problem?