buildQuery from jQuery