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
  • 3,722
  • 5
  • 28
  • 58
  • What errors are you getting? Also, use `$(document).ready` instead of `$().ready`. – Blender Jan 29 '12 at 01:58
  • Superb timing, I only opened the hosting this morning and just as I've posted this i'm having a nameserver propagation issue so I cant get at the site at the moment. – Mrk Fldig Jan 29 '12 at 02:03
  • I used visual studio to debug it the line it was hitting was.... – Mrk Fldig Jan 29 '12 at 02:14
  • line 4 5 char as I remember which doesnt seem to make sense, although the other errors pointed at the click() binding hence me thinking its the ajax requests – Mrk Fldig Jan 29 '12 at 02:15
  • On that note i'm off to bed been at this for 15 hours, I think you guys should be able to look at the site if you feel inclined to do so as its hosted in the states so your nameserver propagation should in theory be a bit quicker – Mrk Fldig Jan 29 '12 at 02:17
  • Did you try my first suggestion? – Blender Jan 29 '12 at 14:09
  • Sorry Blender the $document.ready? Yep changed it, unfortunately i'm still waiting for full propagation I can get to the site now but not the ftp location, should be alright soon then i'll let you know. – Mrk Fldig Jan 29 '12 at 19:38
  • Ok getting somewhere now, first I put all the pages through W3 validator to get rid of any stupid html errors. The FAQ script error was due to me having onclick event which was onclick="testimonial(); – Mrk Fldig Jan 30 '12 at 09:53
  • Ok all sorted this is my fault actually because I am learning HTML my syntax wasnt correct enough for IE, I was missing script type tags and I incorrectly nested UL elements and
    all of which made ie throw a script error (which it actually isnt)!
    – Mrk Fldig Jan 30 '12 at 10:03

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
  • 275,078
  • 51
  • 420
  • 480
Mrk Fldig
  • 3,722
  • 5
  • 28
  • 58