我有兩個幾乎相同的JQuery請求,我在頁面加載後發出,第一個請求json當前路徑,第二個請求不同的網址。不過,我很驚訝地看到,第一個請求type
是text/html
,第二個是application/json
。我本來預計都是application/json
。該請求是這個樣子:Ajax請求到當前路徑請求`text/html`而不是`application/json`
$.ajax({
url: window.location.pathname,
type: 'GET',
dataType: 'json',
success: doSomething
});
$.ajax({
url: '/tags',
type: 'GET',
dataType: 'json',
success: doSomethingElse
});
然而,在網絡中標籤我看到:
我缺少什麼?
感謝您的回答。它看起來像是軌道的一部分,並沒有達到我期望的水平。 – lobati 2015-02-06 15:15:07