我在通过https进行Ajax调用时遇到问题。
我使用自托管的WebAPI,侦听端口9000. index.html
页面已正确加载,但是对api的调用突然再次 http 。
我在JavaScript代码中随处可见,但我只给了https-url一次。这是缓存问题吗?问题出现在Firefox,IE和Chrome中,所以我几乎不相信。 jQuery在做之前是否准备了调用?
网址似乎正确的最后一段代码在这里:
/**
* Makes an HTTP GET request.
* @method get
* @param {string} url The url to send the get request to.
* @param {object} [query] An optional key/value object to transform into query string parameters.
* @param {object} [headers] The data to add to the request header. It will be converted to JSON. If the data contains Knockout observables, they will be converted into normal properties before serialization.
* @return {Promise} A promise of the get response data.
*/
get: function (url, query, headers) {
return $.ajax(url, { data: query, headers: ko.toJS(headers) });
}
这是控制台错误:
答案 0 :(得分:0)
我找到了它:不幸的是,开发环境转到了另一个目录而不是测试环境...所以只有错误的网址。