ruby: fix error function in jquery post