如何在jquery ajax调用中设置头文件?

时间:2016-02-06 09:17:30

标签: jquery ajax

我正在使用带休息的网络服务,但它需要两个标头$config['mongo_db']['default']['no_auth'] = FALSE; $config['mongo_db']['default']['hostname'] = 'localhost'; $config['mongo_db']['default']['port'] = '27017'; $config['mongo_db']['default']['username'] = 'root'; $config['mongo_db']['default']['password'] = 'root'; $config['mongo_db']['default']['database'] = 'exam'; Finicity-App-Key。在该网站的示例中 合作伙伴身份验证,他们使用Content-Type并使用两个标头发送它。但是当我尝试在jquery中设置它时,如果我检查开发工具中的网络选项卡,我没有在我创建的ajax上看到这两个头文件。它们似乎显示在curlaccess-control-request-headers

有谁知道什么是错的?

由于

https://developer.finicity.com/admin/docs

content-type,finicity-app-key

1 个答案:

答案 0 :(得分:1)

试试这个

$.ajax({
    url: 'your url',
    headers: { 'Finicity-App-Key': 'a0874b0eda76ae7918c779f8eeef92c1a' }
});