469,609 Members | 1,687 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

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

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!

Dec 1 '06 #1
1 1148
Pugi! wrote:
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

Dec 1 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by melledge | last post: by
3 posts views Thread by caston | last post: by
1 post views Thread by www.web20developers.com | last post: by
10 posts views Thread by trpost | last post: by
reply views Thread by Free Ebooks | last post: by
10 posts views Thread by =?Utf-8?B?WWFua2VlIEltcGVyaWFsaXN0IERvZw==?= | last post: by
6 posts views Thread by Jonathan Wood | last post: by
6 posts views Thread by Scott M. | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.