LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-16-2011, 02:12 PM   #1
bluegospel
Member
 
Registered: Jan 2010
Distribution: centOS
Posts: 404

Rep: Reputation: 53
Ajax discrepancies


Hi. I've recently placed my website in public view, but I have two slight problems, one of which occurs only when my files are on this web host.

The site works almost perfectly except that my links (on the top menu, and the first and 3rd on the side menu) that are supposed to load via jQuery's ajax-rendering "load()" function default instead, loading the entire page. Please note, they work on firefox/centOS, but not IE, and this bad behavior doesn't show up at all on my own web-server. You can see from the default that the bottom right part should be the only part that reloads.

I've tested the public code on my CentOS_5/Firefox (3.6.24) which works fine on either server

I've tested it on my own XP, and another IE which I believe was Windows 7, both of which load the default pages (not the ajax pages).

Here's the link: bluebounty.net

Thanks!

Last edited by bluegospel; 11-16-2011 at 04:18 PM. Reason: Specify disobedient links
 
Old 11-16-2011, 09:31 PM   #2
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Which version of IE? BTW this is an age old tale in web design if you're new to this. It's always, design for everything, and then redesign for IE hehe.

Last edited by sag47; 11-16-2011 at 09:32 PM.
 
Old 11-17-2011, 10:18 AM   #3
bluegospel
Member
 
Registered: Jan 2010
Distribution: centOS
Posts: 404

Original Poster
Rep: Reputation: 53
Quote:
Originally Posted by sag47 View Post
Which version of IE? BTW this is an age old tale in web design if you're new to this. It's always, design for everything, and then redesign for IE hehe.
I am new but, yeah, in the last year I've learned the stupidity of IE's defiance of reasonable standards, and the need to work around it.

I've tested on IE8 at home on XP, and probably the same version of IE on Vista--they do the same thing--load the default rather than run the ajax.
 
Old 11-17-2011, 05:57 PM   #4
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
You might want to write your own AJAX request handler for IE rather than using JQuery or XYZ JavaScript library.

See XMLHttpRequest.

You can detect the browser using JavaScript like so...

Code:
var msie=(navigator.userAgent.indexOf("MSIE")>0)?1:0;
if(msie)
{
  //do an XMLHttpRequest for IE
}
else
{
  //use JQuery or XYZ library for everything else.
}
For other detection strings you can look at QuirksMode or I wrote some stuff.

I know me telling you to reinvent the wheel is a bummer but the thing is IE is changing. Not sure for better or worse but it is changing. I know this because I use the mootools library and the AJAX doesn't work at all in IE9 (haven't tested IE8).

So basically what I'm telling you is: when bullets don't work, bombs and nuclear missiles will. Write just for IE and then account for the rest of the world; strictly speaking about AJAX. There are other nuances but I'm sure you'll discover them over time as you gain more experience doing the whole web design thing.

You might also want to alert your UserAgent on IE in case something has changed in that regard.

SAM

Last edited by sag47; 11-17-2011 at 06:00 PM.
 
1 members found this post helpful.
Old 11-17-2011, 06:25 PM   #5
bluegospel
Member
 
Registered: Jan 2010
Distribution: centOS
Posts: 404

Original Poster
Rep: Reputation: 53
Quote:
Originally Posted by sag47 View Post
You might want to write your own AJAX request handler for IE rather than using JQuery or XYZ JavaScript library.

See XMLHttpRequest.

You can detect the browser using JavaScript like so...

Code:
var msie=(navigator.userAgent.indexOf("MSIE")>0)?1:0;
if(msie)
{
  //do an XMLHttpRequest for IE
}
else
{
  //use JQuery or XYZ library for everything else.
}
For other detection strings you can look at QuirksMode or I wrote some stuff.

I know me telling you to reinvent the wheel is a bummer but the thing is IE is changing. Not sure for better or worse but it is changing. I know this because I use the mootools library and the AJAX doesn't work at all in IE9 (haven't tested IE8).

So basically what I'm telling you is: when bullets don't work, bombs and nuclear missiles will. Write just for IE and then account for the rest of the world; strictly speaking about AJAX. There are other nuances but I'm sure you'll discover them over time as you gain more experience doing the whole web design thing.

You might also want to alert your UserAgent on IE in case something has changed in that regard.

SAM
Thanks. Originally I bypassed jQuery and tried to do everything in javascript, but I didn't realize how jQuery covers so much. And now I know the problem I'm having in this case must be extremely simple--My code works perfectly when I refresh after the initial load; then I can click my links on my main menu and the parts of the page that should load do so. Why it works in this case is beyond me. My solution has to be very obvious to someone, but I think I've lost folks' attention.
 
Old 11-17-2011, 11:55 PM   #6
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
It could also be that you're not developing for a particular standard for the w3c. You should choose an actual standard because it will change the render mode of the browser. It makes code more reliable; this includes in IE.

http://validator.w3.org/

You should always use that to validate your code. FYI I'm still tearing apart and understanding your code so it may take some time for me to get a good grasp at it (and to look at it a couple of times).

Last edited by sag47; 11-17-2011 at 11:56 PM.
 
Old 11-18-2011, 10:24 AM   #7
bluegospel
Member
 
Registered: Jan 2010
Distribution: centOS
Posts: 404

Original Poster
Rep: Reputation: 53
Quote:
Originally Posted by sag47 View Post
FYI I'm still tearing apart and understanding your code so it may take some time for me to get a good grasp at it (and to look at it a couple of times).
Thanks. I appreciate that a lot.
 
Old 11-18-2011, 11:40 AM   #8
bluegospel
Member
 
Registered: Jan 2010
Distribution: centOS
Posts: 404

Original Poster
Rep: Reputation: 53
I took your advice and validated my code. There were 16 or 17 errors which I fixed (including dynamically written link attributes w/out quotes & some empty attributes), but I'm still having the same issue.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
To use or not to use Ajax clau_bolson Programming 2 04-08-2008 04:19 PM
LXer: Solid Ajax applications, Part 2: Building Ajax back ends LXer Syndicated Linux News 0 01-22-2008 12:30 PM
Ajax v/s Php prabhum Programming 4 08-21-2007 01:42 AM
LXer: Eclipse Ajax Toolkit Framework and Ajax tools LXer Syndicated Linux News 0 05-12-2006 12:21 PM
LXer: Mastering Ajax, Part 3: Advanced requests and responses in Ajax LXer Syndicated Linux News 0 02-16-2006 06:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration