JavaScript ajax wrapper for rails app