AJAX-problem : layout isn't applied on new elements

P

Pugi!

I want to create a virtual filesystem. When you open page you see a
number of 'folders' represented by a name and an icon. When you click
on the icon an xmlhttprequest is send retrieving the subfolders and
files. When you click on thus created representation of a subfolder a
new xmlhttprequest is send to the server to retrieve the subfolders and
files for that subfolder.
On the serverside I create a domdocument (php) which contains html-tags
(div, h2, span, img, ...) and send it as xml to the client javascript.
I get the information (the html tags and attributes like src, id, href,
.... are ok) and take the root element and put in in the specified place
on my html-page. Only the titles of the subfolders (h2-tag) are shown
as text and they stick together instead of showing up in bold and
sperated like a good h2 should do. (I don't retrieve the files yet).
The layout isn't used, no images are shown, h2 is shown as plain text,
.... When I view the generated source with webdeveloper toolbar in
firefox everything looks fine, when I save generated source as html and
open it in browser the correct layout is applied.
What I am doing wrong ?

Pugi!
 
E

Erwin Moller

Pugi! said:
I want to create a virtual filesystem. When you open page you see a
number of 'folders' represented by a name and an icon. When you click
on the icon an xmlhttprequest is send retrieving the subfolders and
files. When you click on thus created representation of a subfolder a
new xmlhttprequest is send to the server to retrieve the subfolders and
files for that subfolder.
On the serverside I create a domdocument (php) which contains html-tags
(div, h2, span, img, ...) and send it as xml to the client javascript.
I get the information (the html tags and attributes like src, id, href,
... are ok) and take the root element and put in in the specified place
on my html-page. Only the titles of the subfolders (h2-tag) are shown
as text and they stick together instead of showing up in bold and
sperated like a good h2 should do. (I don't retrieve the files yet).
The layout isn't used, no images are shown, h2 is shown as plain text,
... When I view the generated source with webdeveloper toolbar in
firefox everything looks fine, when I save generated source as html and
open it in browser the correct layout is applied.
What I am doing wrong ?

Pugi!

Are you maybe using Javascript in the response?
(If you want your Ajax-response to contain JS, you need more than just
returning the JS.)

eg, if this is the response from the server via AJAX, and you put it in some
div, nothing will happen, except the rendering of the html:
------- START AJAXRESPONSE ---------
<h1>You can see me</h1>
<script type="text/javascript">
alert("I do not execute at all.");
</script>
------- END AJAXRESPONSE -----------

Regards,
Erwin Moller
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,607
Members
45,241
Latest member
Lisa1997

Latest Threads

Top