0

First I should say I only started learning HTML,PHP,Jquery a couple of weeks ago and just as i've got a nice looking site I happened to take a look in IE7 and its totally useless, I generally use chrome or firefox so lesson learned there.

I get script errors in IE7 on this(explanation below) I get the errors whenever I click any menu item, specifically the FAQ one, I can't get the html to format properly here but feel free to visit the site and check it out.

Basically these are click events for a menu (site is www.romaniantranslate.co.uk) I've validated the javascript using jsfiddler.

    $().ready(function() {

$('.kwicks').kwicks({max : 220,spacing : 5});
$.ajax({url: "home.php",type: "GET",success: function(data){ $('#content').html(data);}});

$('#kwick1').click(function() {$.ajax({url: "home.php",type: "GET",success: function(data){ $('#content').html(data);$('#container1').height(300);}});});

$('#kwick2').click(function() {$.ajax({url: "faq.php",type: "GET",success: function(data){ $('#content').html(data);$('#container1').height(450);}});});

$('#kwick3').click(function() {$.ajax({url: "contact.php",type: "GET",success: function(data){ $('#content').html(data);$('#container1').height(375);}});});

$('#kwick4').click(function() {$.ajax({url: "testimonials.php",type: "GET",success: function(data){ $('#content').html(data);$('#container1').height(375);}});});

});

Any help would be greatly appreciated.

Cheers

Marc

Mrk Fldig
  • 4,244
  • 5
  • 33
  • 64

1 Answers1

0

I noticed there are a few people asking essentially the same question across the web so I thought i'd answer on the off chance someone finds this.

When your doing:

$('ELEMENT').click(function() {$.ajax({url: "WHATEVER.php",type: "GET",success: function(data){ $('#content').html(data);});});

If there is an error in your HTML anywhere IE7 throws a script error pointing at the $.ajax call rather than the information your fetching. MAKE SURE you've got the call right with no extra comma's too.

I had scripts in the wrong parts of the the document too which is just a newbie mistake.

Also $('#ELEMENT').height(100) doesnt work in IE7 you need to use .css('height', '100') which is probably better practice anyway.

Oh and don't forget to delete browsing data each time you alter your page with IE7 even refresh doesnt appear to pull down a new page in all cases.

Thanks to blender for his initial pointer that got me thinking.

Blender
  • 289,723
  • 53
  • 439
  • 496
Mrk Fldig
  • 4,244
  • 5
  • 33
  • 64