DBookatay Posted April 11, 2012 Share Posted April 11, 2012 I am almost done with my sites rebuild and am now in the testing phase. While testing in IE7 and 8 i found out that becuase of a json script I have my jquery scripts will not work properly, even though they do in all other browsers, including IE9. The page is: http://www.carcityofdanbury.com/New/?cat=01&do=View&stock=18481 The script is the Info Request form, something in this line: ".append("<p>Thank you " + data.name + ",</p><p class=\"indent\">we recieved your info request " + data.for + " on our<br />'.$vehicle.' and will contact you shortly.</p>")" is causing the jquery tabs to no longer work. I did the php and jquery coding, but hired someone to do the json, so I do not know how to fix this. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/260713-why-is-this-json-script-not-working-in-ie7-8-but-works-in-all-other-browsers/ Share on other sites More sharing options...
trq Posted April 11, 2012 Share Posted April 11, 2012 Have you tried inspecting data within firebug ? what does it look like? Quote Link to comment https://forums.phpfreaks.com/topic/260713-why-is-this-json-script-not-working-in-ie7-8-but-works-in-all-other-browsers/#findComment-1336397 Share on other sites More sharing options...
haku Posted April 11, 2012 Share Posted April 11, 2012 $vehicle jQuery uses $vehicle as an alias. Maybe this is causing your conflict. Quote Link to comment https://forums.phpfreaks.com/topic/260713-why-is-this-json-script-not-working-in-ie7-8-but-works-in-all-other-browsers/#findComment-1336416 Share on other sites More sharing options...
nogray Posted April 11, 2012 Share Posted April 11, 2012 Make sure your JSON is correct and the last item does not have a comma after it. Quote Link to comment https://forums.phpfreaks.com/topic/260713-why-is-this-json-script-not-working-in-ie7-8-but-works-in-all-other-browsers/#findComment-1336448 Share on other sites More sharing options...
DBookatay Posted April 11, 2012 Author Share Posted April 11, 2012 Tried both suggestions and neither worked... On stackoverflow.com someone said: "The issue is with data.for and it sounds a bit like you (the person who wrote the code) are trying to access one of the reserved names. Even though data.for should be valid, IE doesn't like names which it thinks are special (class for example). data.class would cause a problem in IE, even though it's valid. Try to rename data.for to something else data._for for example. Make sure you update the 01/Resources/infoRequest.php PHP file to return the new value as well." so I changed data.for to data.test and it did solve the issue in IE8, but IE7 still screws up my jquery. Here is the entire code, anybody see anything wrong? <script language="javascript" type="text/javascript"> $(document).ready(function() { // Tabs $("#tabs").tabs(); // Google map $(\'#embed\').gmap3( {action: \'addMarker\', lat:41.40372, lng:-73.45844, map:{center: true, zoom: 17, mapTypeId: google.maps.MapTypeId.ROADMAP}} ); // Pic popup $("#viewPics").fancybox({ \'type\': \'iframe\', \'transitionIn\': \'fade\', \'transitionOut\': \'fade\', \'width\': 900, \'height\': 500, \'autoScale\': false, \'scrolling\': \'no\' }); // Form Validation jQuery.validator.messages.required = ""; $("#infoForm").validate({ invalidHandler: function(e, validator) { var errors = validator.numberOfInvalids(); if (errors) { var message = errors == 1 ? \'You missed 1 required field.\' : \'You missed \' + errors + \' required fields\'; $("li.Error span").html(message); $("li.Error").show(); } else { $("li.Error").hide(); } }, onkeyup: false, submitHandler: function(form) { $.ajax({ url: "01/Resources/infoRequest.php", type: "POST", cache:false, data: $("#infoForm").serialize(), dataType: "json", success: function(data) { $("li.Error").hide(); $("#contact_form").html(\'<div id="message"></div>\'); $("#message").html("<h2>Info Request Submitted!</h2>") .append("<p>Thank you " + data.name + ",</p><p class=\"indent\">we recieved your info request " + data.test + " on our<br />'.$vehicle.' and will contact you shortly.</p>") .hide() .fadeIn(2500, function() { $("#message").append("<p>Would you like to <a href=\"?cat=02&stock='.$stock.'\">prefill an application</a> now?</p>") }); } }); }, }); }); </script> Quote Link to comment https://forums.phpfreaks.com/topic/260713-why-is-this-json-script-not-working-in-ie7-8-but-works-in-all-other-browsers/#findComment-1336494 Share on other sites More sharing options...
DBookatay Posted April 11, 2012 Author Share Posted April 11, 2012 Crap... I solved it. There was an extra comma onkeyup: false, submitHandler: function(form) { $.ajax({ url: "01/Resources/infoRequest.php", type: "POST", cache:false, data: $("#infoForm").serialize(), dataType: "json", success: function(data) { $("li.Error").hide(); $("#contact_form").html(\'<div id="message"></div>\'); $("#message").html("<h2>Info Request Submitted!</h2>") .append("<p>Thank you " + data.name + ",</p><p class=\"indent\">we recieved your info request " + data.test + " on our<br />'.$vehicle.' and will contact you shortly.</p>") .hide() .fadeIn(2500, function() { $("#message").append("<p>Would you like to <a href=\"?cat=02&stock='.$stock.'\">prefill an application</a> now?</p>") }); } }); }, The very last comma in the code had to be removed. Quote Link to comment https://forums.phpfreaks.com/topic/260713-why-is-this-json-script-not-working-in-ie7-8-but-works-in-all-other-browsers/#findComment-1336496 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.