Link to home
Start Free TrialLog in
Avatar of Wayne Barron
Wayne BarronFlag for United States of America

asked on

Ajax CSS IE8 (FF, Chrome work, but not IE8)

Hello All;

I am trying to load some CSS through AJAX.
This works for FF and Chrome, but not in IE8 (Possibly none of the IE's)

IE8 could very well be doing it correctly, since it is running through a "div"
And css most likely is not suppose to run through a div?

Test with: FF and Chome, click the Submit, and it will change to [Black]
IE does not change...
http://ee.cffcs.com/ajax/css/1.asp
code
http://ee.cffcs.com/ajax/css/ajax.zip

Anyway around this?

On my site, I have it so people can use a Profile Create to design their profiles.
And I am using AJAX to allow for them to see everything in real-time.
This IE deal, is the only thing that is stopping the profile editor to go live
Of which I am hoping will be later on this after towards the evening.

I just ran a test to see if CSS can in fact load through a <div> and it can.
BUT, it will not load the CSS coming through the AJAX.

Thank you all.
Carrzkiss
Avatar of David S.
David S.
Flag of United States of America image

All I see on the page is "Service Unavailable".

Would you please post the relevant JavaScript code separately?
Avatar of Wayne Barron

ASKER

Yea, aint that crap.
I contacted the hosting company and they are trying to fix it.
THe bad thing is that it is only on our account.
This is the 2nd time this week that it has happened....

Maybe it will be back up later on.


ajax.zip
hey Kravimir
I just downloaded another code that is jQuery.
And am "attempting" to implement this project into it.
BUT, within the example that I downloaded, I was able to send the css through
So, it is the ajax that I am using here that is not working in IE8.


form.zip
So you're receiving a <style> element with some style rules from an AJAX request and then you're just adding to a <div>? I'm not surprised that it doesn't work. For one thing, <link> and <style> elements should always be children of the <head> element. Also adding new stylesheets on the fly is more difficult than it should be (there are several compatibility issues in this area).

Why are you using AJAX anyway? As far as I can tell you're not doing anything with it that you could do directly with just JS. If you were saving the styles to a database it would make sense, but you don't seem to be doing that.

Check these out:
http://www.phpied.com/dynamic-script-and-style-elements-in-ie/
http://www.hunlock.com/blogs/Totally_Pwn_CSS_with_Javascript
That other code you found is not very well written and besides jQuery 1.2.6 is rather old. The current version is 1.4.2.
ok.

The real site does the following.

The user is able to create their online profile before submitting it to the database.
The Ajax comes in when the user is testing the new css settings that they have created.
Once they get the styles that they want, then they choose to save it and it is inserted into the database.


Now.
The jQuery script that I just uploaded, does this.
So, I am going to work with learning on how to implement what I need with it.

have a good one
Carrzkiss
do you have a link to some code that is done with the new current version with ASP Classic?
That is the only example that I could find with Classic ASP and jQuery.

Thanks.
@Kravimir

Please let me know if you know of any tutorials with the new jQuery and Classic ASP?
If you do not, please let me know so that I am not sitting here waiting on something that is not coming...

Carrzkiss
I don't use ASP myself, so no, I don't know of a better example than the one you found. You may be able to just switch in the current version of jQuery without changing the rest of the code.

There's always the chance that someone else might reply.
thanks
I have been playing around with the code and cannot get it to work.
Then again, I do not really understand, so it is going to be a learning process.

Have a good weekend.
Carrzkiss
ASKER CERTIFIED SOLUTION
Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial