Change AJAX request content to fit the RAILS way

- Modified the js content to simplify usage in RAILS