我正在使用jquery fileupload从网站制作图库图片,但在某些浏览器中我可以正常上传图片但在另一个浏览器中这段代码不起作用并在控制台中返回错误" parseerror&# 34;,任何人都可以帮助我?
function uploadGaleriaEstabelecimento(){
var url = window.location.hostname === 'example.com' ? 'http://www.example.com/control/php/request/ajax.files.estabelecimento.php' : '';
console.log(url);
$('#fileupload').fileupload({
url: url,
dataType: 'json',
error: function (error, req) {
console.log(error);
console.log(req);
$('.alert-galeria-erro').slideDown();
setTimeout(function(){ $('.alert-galeria-erro').slideUp() }, 7000);
},
done: function (e, data) {
$.each(data.result.files, function (index, file) {
$.ajax({
url : URL_BASE + "php/request/ajax.files.estabelecimento.php",
data: {register:"1",estabelecimento:$("#estabelecimento").val(), file:file.name},
type: "POST",
dataType:"json",
success : function (response){
console.log(response.id);
$(".lista-files").append("<li id='imagem-"+response.id+"'><img src='images/estabelecimento/" + file.name + "' height='200' ><form class='ordem'><input type='text' name='ordem' value='0' size='2'><input type='hidden' name='id' value='"+response.id+"'><input type='submit' value='Salvar' class='ls-btn'><button data-ls-module='modal' data-id='"+response.id+"' data-target='#apagar-modal' class='apagar-modal ls-btn-danger'>Apagar</button></form></li>");
}
});
});
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#progress .progress-bar').css(
'width',
progress + '%'
);
}
}).prop('disabled', !$.support.fileInput)
.parent().addClass($.support.fileInput ? undefined : 'disabled');
}