Move saving of cookie to general space + do ajax call to get closest x