我正在使用此插件进行文件上传 http://malsup.com/jquery/form/#ajaxForm
在我的HTML中,我有:
<form id="importForm" name="Import" enctype="multipart/form-data">
<input name="import-input" id="importInput" type="file" />
<button id="importBtn" class="btn btn-large" style="margin-top:10px" >Import</button>
</form>
然后按下导入时,我会调用:
handleImportBtn(event) {
var successCallback: (data: any, textStatus: string, jqXhr: JQueryXHR) => void = this.handleResponse;
var options = {
url: "import/upload",
type: "POST",
success: successCallback
};
this.$(this.ui.importForm).ajaxForm(options);
这个表单是从一个类似于:
的网址调用的mysite/area/
在FF和Chrome中,它做对了,mysite/area/import/upload
被击中了。然而,在IE中,情况并非如此。相反,
mysite/import/upload
被击中。在IE 9中,url的相对路径不存在。
为什么会这样?我该怎么做才能让它在IE 9中运行? : - \提前谢谢!
答案 0 :(得分:0)
我不知道为什么绝对网址对我也不起作用。我收到301错误。在搜索了一些像这篇文章(HTML Form action tag. Calling a parent relative URL)之类的想法之后,我想出了这个有效的方法。
url: "../myArea/import/upload"