javascript / ajax适用于chrome但不适用于firefox

时间:2015-09-02 00:36:30

标签: javascript jquery ajax google-chrome firefox

我把整个代码放在了安全的位置,但我真的只想修复代码的ajax部分,它每秒都会更新我网站的部分内容。它在firefox和chrome中都很重要,我最近才意识到它在FF中不起作用。任何人都可以给我一个提示,告诉我为什么它不在FF工作?我认为这是一个非常小的错误。



var ls=0;
var roulet=0;
var clos=0;
var timerinterval;
var timerinterval2;

window.onload = function() {
	timerinterval = setInterval("reloadinfo()",1000);
        timerinterval2 = setInterval("lastwinner()", 10000);
	$(document).on('click', '.sound-link-on', function() {
                $('.sound-link-on').addClass('hidden');
                $('.sound-link-off').removeClass('hidden');
                var audioElement = document.createElement('audio');
				audioElement.setAttribute('src', 'audio/1.mp3');
				var audioElement2 = document.createElement('audio');
				audioElement2.setAttribute('src', 'audio/1.mp3');
				var audioElement3 = document.createElement('audio');
				audioElement3.setAttribute('src', 'audio/1.mp3');
        });

        $(document).on('click', '.sound-link-off', function() {
                $('.sound-link-off').addClass('hidden');
                $('.sound-link-on').removeClass('hidden');
                var audioElement = document.createElement('audio');
				audioElement.setAttribute('src', 'audio/audio.mp3');
				var audioElement2 = document.createElement('audio');
				audioElement2.setAttribute('src', 'audio/msg.mp3');
				var audioElement3 = document.createElement('audio');
				audioElement3.setAttribute('src', 'audio/open.wav');
        });
		
		$(document).on('click', '.closech', function() {
				$('.closech').addClass('hidden');
				$('.closechs').removeClass('hidden');
				$('.hjgf').removeClass('hidden');
		});
		$(document).on('click', '.closechs', function() {
				$('.closech').removeClass('hidden');
				$('.closechs').addClass('hidden');
				$('.hjgf').addClass('hidden');
        });
		
};



function alert2(txt,typet) {
	var n = noty({
		layout: 'bottomRight',
		text: txt,
		type: typet,
		timeout: 10000
	});
	audioElement.play();
}

function lastwinner() {
if(roulet == 0) {
	$.ajax({
		type: "GET",
		url: "lastwinner.php",
		success: function(msg){
			$('#lastwinner').html(msg);
		}
	});
}
}

function reloadinfo() {
	$.ajax({
		type: "GET",
		url: "currentchance.php",
		success: function(msg){
			$("#mychance").text(msg);
		}
	});
	$.ajax({
		type: "GET",
		url: "currentitem.php",
		success: function(msg){
			$("#myitem").text(msg);
		}
	});
	$.ajax({
		type: "GET",
		url: "currentbank.php",
		success: function(msg){
			$('#money_round').text(msg+'');
		}
	});
	$.ajax({
		type: "GET",
		url: "items.php",
		success: function(msg){
			$('.rounditems').html(msg);
		}
	});
	$.ajax({ 
		type: "GET",
		url: "currentitems.php", 
		success: function(msg){ 
			$(".selector-items-counter").html(msg); 
		} 
	}); 
	$.ajax({
		type: "GET",
		url: "currentitemswidth.php",
		success: function(msg){
			$('#meter').width(msg);
		}
	});
	$.ajax({
		type: "GET",
		url: "timeleft.php",
		success: function(msg){
			$('#timeleft').html(msg);
		}
	});
}




0 个答案:

没有答案