PHP + JS + CSS: why ajax doesn't display using CSS on main doc?

S

SeanInSeattle

So, I've got a blog showing posts using AJAX, and paginated also using
AJAX.

My question is this: why would the posts not show up using the post-
specific CSS if the styles are declared within an external sheet
(post.css) which is included within the header of "listing-
dynamic.php"? If the blog div innerHTML changes, shouldn't it still
be showing underneath the main documents included style sheets?
 
P

Peter Michaux

So, I've got a blog showing posts using AJAX, and paginated also using
AJAX.

My question is this: why would the posts not show up using the post-
specific CSS if the styles are declared within an external sheet
(post.css) which is included within the header of "listing-
dynamic.php"? If the blog div innerHTML changes, shouldn't it still
be showing underneath the main documents included style sheets?

Yes, when a particular blog post is retrieved using Ajax and inserted
into the main page, the CSS style sheet in the main page will apply to
that newly inserted bit of HTML. At least if everything is set up
correctly and the CSS selectors are correct.

Peter
 
S

SeanInSeattle

Yes, when a particular blog post is retrieved using Ajax and inserted
into the main page, the CSS style sheet in the main page will apply to
that newly inserted bit of HTML. At least if everything is set up
correctly and the CSS selectors are correct.

Peter

The reason why I posted is because what I've been doing *isn't*
working. I used "document.getElementById.(div_element_id).innerHTML =
response_txt" to insert the posts, but should I have used something
else?
 
S

SeanInSeattle

The reason why I posted is because what I've been doing *isn't*
working. I used "document.getElementById.(div_element_id).innerHTML =
response_txt" to insert the posts, but should I have used something
else?

Also, in my css, I'm using a classes to apply styles to the posts.
When inserting the posts, I'm also inserting new div's around each
post with class="post", but when they display they're not showing up
with the styles that were included on the main document level.
 
D

David Dorward

The reason why I posted is because what I've been doing *isn't*
working.

Well, it should.

Is the document valid?
If you inspect the DOM after performing the operation, does the markup
look as you expect?
If you construct the same DOM manually, does it act as you expect?
What browsers exhibit this problem?
What is the URL so we can see exactly what you are doing?
 
S

SeanInSeattle

Well, it should.

Is the document valid?
If you inspect the DOM after performing the operation, does the markup
look as you expect?
If you construct the same DOM manually, does it act as you expect?
What browsers exhibit this problem?
What is the URL so we can see exactly what you are doing?

LOL... um yeah. I'm a dumb ass. I said, include "post" instead of
including "post.css". Basically, it didn't apply the post css because
I didn't include the full filename. Sorry folks, just a typo.
 

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,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top