我正在创建一个 facebook 应用程序,并希望使用jquery form plugin实现类似 ajax 的图片上传。在 chrome/ff 中一切正常,但在 iexplorer 中我得到以下错误:
Message: Access Denied
Line: 349
Char: 5
Code: 0
URI: http://application.my_domain.gr/apps/new_app/js/jquery.form.js
我知道跨域问题,但不明白为什么会这样,因为我目前使用的所有脚本都在同一个域上。
以下是我在 firefox/chrome 中的工作方式:
<html>
<head>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.form.js"></script>
</head>
<body>
<form id="imageform" method="post" enctype="multipart/form-data" action='ajaximage.php'>
<input type="file" name="photoimg" id="photoimg" />
</form>
<div id='preview'>
</div>
<script>
$('#photoimg').bind('change', function() {
$("#preview").html('');
$("#preview").html('<img src="img/loader.gif" alt="Upload in progress"/>');
$("#imageform").ajaxForm({
target: '#preview',
success: function() {
$("#preview img").attr("id", "uploaded_img");
}
}).submit();
});
</script>
</body>
</html>
任何想法为什么会发生这种情况?
提前致谢。