jQuery - Simple Ajax Error, Or complex Safari Issue?
This following code snippet works in FF, IE and Chrome.
However It does not work in Safari 5.0.3! Safari does not return an error message of any kind. ( Please take note that the 'debugger;' command for some reason never catches in any browser and the alert pop up never happens 'alert ('Pop up will now close');', however the ajax seems to work in the mentioned 3 st开发者_高级运维ill somehow )$(document).ready(function(){
// debugger; <-- This works
$(".oscform").click(function(){
debugger; // <-- this doesn't
alert ('Pop up will now close');
getCodeEZ(''+$(this).attr('lmgthing'),''+$(this).attr('ezprod'),''+$(this).attr('count'));
$.ajax({
url: '/shopping_cart.php?osCsid=<?php echo $osCsid; ?>',
type: "POST",
data: 'sort=2a&ezprod='+$(this).attr('ezprod'),
async:false,
error: function(xhr,err){},
success: function(data){}
}
)
//closePop();
});
// more code below
I never found out why the debugger doesn't work in the example, However polarblau gave a good hint to use console.log(), which is very helpful and gave me insight to the issue.
I found out that the problem for some strange reason was that another javascript did not have its closing tag on some other part of the page with an AJAX call. This was a coding issue on my part. While adding the closing tag made Safari run flawlessly, it did somehow break IE, Chrome and Firefox! So I changed the coding style a little bit and it fixed the rest of my issues.
精彩评论