我做使用jQuery Ajax調用和我的網址是像如何獲得當前頁面的路徑的jQuery(同時做Ajax調用)
http://localhost;3327/DummyAps/Demo.aspx
在Demo.aspx頁我有一個WebMethod,這是我想打電話。在做jQuery ajax調用時,我將URL設置爲「/ DemoWebMethod」,其中「DemoWebMethod」是Demo.aspx頁面中的Webmethod。
但同時調用的WebMethod它調用URL http://localhost;3327/DummyAps/DemoWebMethod但我想打電話給 http://localhost;3327/DummyAps/Demo.aspx/DemoWebMethod。
我知道將URL從「/ DemoWebMethod」更改爲「Demo.aspx/DemoWebMethod」將解決該問題,但是我可以不用編寫它(因爲我有一些問題)。
有人可以幫我嗎?
的可能重複( http://stackoverflow.com/questions/1034621/get-current-url-with-javascript) – Lazarus 2010-08-18 11:51:46
可能的重複http://stackoverflow.com/questions/406192/how-to-get-the-current-url-也在jQuery中 – 2010-08-18 11:53:40
但是,如果我的網址是像Demo.aspx#divNote或類似的東西,那麼它不工作。 在這種情況下,我必須獲取整個網址並找出確切的網頁名稱。 – 2010-08-18 11:53:46