0
我正在創建一個網站,每個用戶都有他們的uniq頁面。用戶可以通過如何僅使用JavaScript獲取用戶特定頁面?
http://website/user?user=<username>&session=<session>
現在我希望能夠簡化上述網址可
http://website/user/<username> (something like pinterest or facebook)
我以爲我可以使用mod_rewrite訪問其他用戶的網頁。但是,mod_rewrite用於服務器端。我不想包含任何PHP代碼。我所做的是爲用戶獲取數據: 加載基本HTML模板,然後根據我們正在討論的用戶,異步加載用戶數據。
我可以在JS中實現以上嗎?如果是,如何?
-Ajay
函數getParameterByName(名稱){ \t \t \t名稱= name.replace(/ [\ [] /, 「\\\ [」)。代替(/ [\]] /, 「\\\]」) ; \t \t \t var regex = new RegExp(「[\\&&」「+ name +」=([^&#] *)「); \t \t \t results = regex.exec(location.search); \t \t \t返回結果=== null? 「」:decodeURIComponent(results [1] .replace(/ \ +/g,「」)); \t \t} –
很酷。你在哪裏存儲用戶? – Popcorn
服務器:P。還有什麼地方? –