shortysbest Posted November 3, 2010 Share Posted November 3, 2010 Im using Jquery's way of loading data into divs and such, it works fine in firefox, but i just noticed it doesnt work in safari.. Why? my code: function save_changes(id) { var name = $("#product-name").val(); var price = $("#product-price").val(); var descr = $("#product-descr").val(); var photo = $("#product-photo").val(); $(".saved-changes").empty(); $(".saved-changes").append("<div class='changes-saved'>Saving Changes...</div>"); $.ajax({ type: "POST", url: "ajaxpages/update_antique.php", data: "id="+id+"&name="+name+"&price="+price+"&descr="+descr+"&photo="+photo, cache: false, success: function(html){ $(".saved-changes").empty(); $(".saved-changes").append("<div class='changes-saved'>Changes Saved!</div>"); $(".product-unsaved").empty(); } }); } Quote Link to comment https://forums.phpfreaks.com/topic/217617-jquery-ajax-doesnt-work-in-safari/ Share on other sites More sharing options...
michaellunsford Posted November 5, 2010 Share Posted November 5, 2010 Do you have a live link I can look at? Quote Link to comment https://forums.phpfreaks.com/topic/217617-jquery-ajax-doesnt-work-in-safari/#findComment-1130516 Share on other sites More sharing options...
shortysbest Posted November 5, 2010 Author Share Posted November 5, 2010 I do, I would have to update the files to my most current files, but, I recently discovered that it's Multiple variables that is causing the problem. html to call function: <div class="announcements-containers" onClick='view_announcement(this);' id='<?php print $id?>'> javascript code: function view_announcement(obj) { var id = $(obj).attr("id"); var class = $(obj).attr("class"); $("#slideshow").fadeOut("fast"); $(".homeantiqueholder").slideUp("fast"); $('.home-middle-content').animate({height: "490px", marginTop: "-10px"},100); $('.updatestream, #announcer, .announcements-container').animate({ height: "490px"},100); if(class!="announcements-containers announcements-current") { $(".announcements-containers").removeClass("announcements-current"); } $("#"+id).addClass("announcements-current"); $("#announcer").empty(); $("#announcer").html("<div class='announcement-loading'>Loading...</div>"); $.ajax({ type: "POST", url: "ajaxpages/view_announcement.php", data: "id="+id, cache: false, success: function(html){ $(".announcement-close").show(); $("#announcer").html(""); $("#announcer").append(html); } }); } When i delete the if statement inside, and the var class = $(obj).attr("class"); line it works fine in safari, however with both of them it does not. I cannot figure out why, it doesn't make sense. Quote Link to comment https://forums.phpfreaks.com/topic/217617-jquery-ajax-doesnt-work-in-safari/#findComment-1130518 Share on other sites More sharing options...
michaellunsford Posted November 5, 2010 Share Posted November 5, 2010 I'd try renaming the "class" variable since "class" is probably reserved for something. That or just using your straight jquery code $(obj).attr("class") wherever your class variable is. See if that works. Quote Link to comment https://forums.phpfreaks.com/topic/217617-jquery-ajax-doesnt-work-in-safari/#findComment-1130524 Share on other sites More sharing options...
shortysbest Posted November 5, 2010 Author Share Posted November 5, 2010 wow, so I did the 2nd suggestion (putting the code in place of the class variable) and it worked. I dont get why this makes a difference though.. its so annoying...and odd. lol Quote Link to comment https://forums.phpfreaks.com/topic/217617-jquery-ajax-doesnt-work-in-safari/#findComment-1130739 Share on other sites More sharing options...
michaellunsford Posted November 5, 2010 Share Posted November 5, 2010 probably because "class" is reserved for system use. Quote Link to comment https://forums.phpfreaks.com/topic/217617-jquery-ajax-doesnt-work-in-safari/#findComment-1130757 Share on other sites More sharing options...
shortysbest Posted November 5, 2010 Author Share Posted November 5, 2010 well no, I tried it with other names, random names and it still didn't work, as well as i have another script that has like 5 variables,none of which has a name that should be 'reserved' for anything Quote Link to comment https://forums.phpfreaks.com/topic/217617-jquery-ajax-doesnt-work-in-safari/#findComment-1130847 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.