- If you are doing a ajax request it should prefferably be
JSON. - For Json, check for a file named
contacts.json.erbin contacts folder. - You can try using remote true, much clean and better option than ajax/json requests.
Check this : http://railscasts.com/episodes/205-unobtrusive-javascript
try putting in your controller
respond_to do |format| format.html format.json { render :json=> {:success => true, :id => @contact.id } } end Something like this.