Compress AJAX hash in URL with Javascript


New Member
I'm working on an AJAX application that uses Knockout and Sammy for AJAX history. The application uses a set of filters, sort options and pagination to let the user search trough 35000 records.Currently the URL hash is in the following form:\[code\]http://domain/Search/{SearchTerms}/PageIndex\[/code\]For example:\[code\]http://localhost/search/#0%20-%205%C4%80square%20meter/1\[/code\]The search terms are parsed on the server to match them to the available filters. I can't use an Id or something because the filter set is rebuild each day (when backend data updates) and the only thing that stays the same is the description. This is the javascript code to build the hash:\[code\]var hash = '';ko.utils.arrayForEach(self.SelectedItems(), function (item) { hash = hash + item.Description + ' ';});hash = encodeURIComponent($.trim(hash));hash = hash + '/' + self.HuidigePagina();location.hash = hash;\[/code\]The problem is that joining all the item descriptions can become really long. Is there a way I can compress this part and then decompress it when I send it to the server in javascript? I've found some answers here on stackoverflow that uses LZW compression, but it didn't give me my original string back.