Jump to content

Jquery Ajax Doesn't work in Safari??


shortysbest

Recommended Posts

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();	
}
});	

}

Link to comment
https://forums.phpfreaks.com/topic/217617-jquery-ajax-doesnt-work-in-safari/
Share on other sites

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.