2010-10-11 73 views
0

與網址參數的工作,當我做了以下內容:

$.ajax({ 
    type: 'GET', 
    url: 'http://www.domain.tld/feed', 
    dataType: 'xml', 
    success: function(data) { 
    ... 
    } 
}); 

Everything's在IE罰款(8)。

但是,當我的URL選項更改爲

http://www.domain.tld/?feed=myfeed 

IE什麼都不做。我認爲是問題,但我怎樣才能得到這個可愛的瀏覽器工作?

+0

您是否嘗試過加入「飼料」使用'data'參數?可能是GET方法覆蓋了URL中的所有現有GET參數 – 2010-10-11 15:19:31

+1

您的ajax調用中是否有錯誤函數來顯示實際問題?使用錯誤:sytnax在這裏:http://api.jquery.com/jQuery.ajax/ – Paddy 2010-10-11 15:20:00

+0

是的:textStatus返回'parsererror', errorThrown返回'TypeError:Object required' – 2010-10-11 15:46:30

回答

0

試試這個:

$.ajax({ 
    type: 'GET', 
    url: 'http://www.domain.tld/feed', 
    dataType: 'xml', 
    data: "feed=myfeed", 
    success: function(data) { 
     // success handler... 
    } 
}); 

當你爲一個url做到這一點:http://www.domain.tld/?feed=myfeed

我相信你說的請求默認頁面的域名:http://www.domain.tld/

[編輯]

Ajax IE Caching Issue

+0

只有第一個Feed有URL「/ feed」,第二個只是基本URL的參數,而不是「/ feed」。 – 2010-10-12 07:17:17

+0

然後它可能是IE瀏覽器的緩存問題,並得到請求。 – Gutzofter 2010-10-12 14:56:44

+0

嘗試鏈接:Ajax IE緩存問題。請參閱上面的編輯 – Gutzofter 2010-10-12 14:57:10

2

而且如果你使用數據對象確實有效嗎?

see here jquery ajax

data (Object, String)

Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below).

你的情況

$.ajax({ 
    type: 'GET', 
    url: 'http://www.domain.tld/', 
    dataType: 'xml', 
    data: "feed=myfeed", 
    success: function(data) { 
    ... 
    } 
}); 
+0

可悲的是同樣的問題。 – 2010-10-11 15:44:09

+0

也嘗試數據的替代格式... – 2010-10-11 16:33:16

+0

數據:({feed:「myfeed」}) – 2010-10-11 16:33:52