Access-Control-Allow-Origin标头出现在请求的资源上

时间:2016-06-08 13:22:24

标签: jquery asp.net-mvc asp.net-web-api

我使用带有jquery的Web api上传了多文件。在我的一个localhost应用程序中,我使用以下内容上传多个文件:

Multiple file upload

现在,当我单击提交按钮所有文件数据时,图像将通过第二个localhost应用程序使用web api保存。我的表格代码在这里描述。

Code Description

当我按下提交按钮给出错误..显示如下: Error

1 个答案:

答案 0 :(得分:1)

您需要在WebAPI中启用交叉源,如下所示

#!/usr/bin/env python

import subprocess
import os
import csv

#write output in a table with three columns namely filename, Total sequences, Total variants, Percentage of variants 

csvfile = "./" #path to output csv
def print_table(table):
    from tabulate import tabulate
        tabulate(table, headers=["Filename","Total sequences", "Total variants", "Percentage variants/total sequences"])
    print_table(table)


with open('query.txt', 'r') as f:
    for line in f:
        line = line.rstrip() # remove trailing whitespace such as '\n'
        subprocess.call(['/bin/grep', line, 'my2.txt'])

cat DataID_F(or R).fas | grep -c ">" > Results.csv (total sequences)
cat DataID_F(or R).fas | grep -c "-AAT-T-" > Results.csv (total variants)

from __future__ import division #calculating the percentage variants