Added api.compact to HttpPouch

Also replaced ajax call to _compact with newly written api.compact