weixin_33698043 2012-01-29 01:56 采纳率: 0%
浏览 22

jQuery AJAX,IE7脚本错误

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

  • 写回答

1条回答 默认 最新

  • weixin_33695450 2012-01-30 10:10
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 python爬取bilibili校园招聘网站
  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件
  • ¥15 不同系统编译兼容问题
  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
  • ¥30 数字电源对DSP芯片的具体要求
  • ¥20 antv g6 折线边如何变为钝角
  • ¥30 如何在Matlab或Python中 设置饼图的高度
  • ¥15 nginx中的CORS策略应该如何配置
  • ¥30 信号与系统实验:采样定理分析