PDA

View Full Version : css not woking through ajax (in IE)


GO ILLINI
01-01-2008, 08:56 AM
God I hate IE! Why can't everyone use firefox...? Anyway,
I have a page that uses Ajax to load another page which has hundreds of links that are then styled into a grid of 25x25 px squares. At least it does it in firefox.
In IE, the links just pile up on top of one another in the top left of the page. The absolute position attribute is in the 1st page(not the included one), but not the top and left attributes(their in the included file). Besides that, no other css works in the included file. And yes, the css is declared before the links are created. Any help would be great.

The main page with the ajax:
http://drama.adamsworld.name/seatedit.php?id=29&sid=8&type=full
The included page
http://drama.adamsworld.name/full_seatedit.inc.php?id=29&sid=8
Both pages are valid strict html

user: temp
pass: 400204183!

-Adam

A1ien51
01-01-2008, 05:44 PM
Well first off....That page that you are including is making your markup wring do to the fact you are dumping the page into the innerHTML. Think about what is happening...multiple title tags, body tags etc.

Use Firebug and take a look at it.

With Ajax you just want to return the content. You really should be using a library to do the Ajax calls since there are a lot f quirks with it that your code does not account for. Since you are using jquery, you should be using Jquery to do the Ajax calls.

Eric

GO ILLINI
01-02-2008, 07:46 AM
What exactly should I drop the new content into if not innerhtml? I'm new to Ajax and would like to learn the basics before I start using the libraries. All of the tutorials I've found use innerhtml... What should I use?

-Adam

GO ILLINI
01-02-2008, 08:36 AM
I win!!!! This is why I love coding...
Apparently style tags are only loaded on the first page load. I consolidated the 2 php functions on the included page (1 created css, 1 created a tags) into 1 that creates a tags with a style attribute and now it works fine in all browsers.
Also, I removed the the extra html,head,... tags from the included page. They were just added because it didn't work and I wanted to see if it worked as validated pages.

The PHP actually runs faster now too...
Still not sure whats wrong with dumping into innerHTML...?

-Adam

A1ien51
01-02-2008, 03:11 PM
You should use innerHTML, but you should not be putting an entre webpage into it.

Would you code a page like this:

<html>
<head>
<title></title>
</head>
<body>
<div>
<html>
<head>
<title></title>
</head>
<body>
<div>
</div>
</body>
</html>
</div>
</body>
</html>


It is not like frames/iframes where you load an entire page. With Ajax you do not return back the entire page, you just include the data that you need. So bring back the code that you wold include inside that div if you were hard coding it right than and there.

Eric