Hello everyone! Currently I'm developping an application with RoR and jQuery. Is the first time I try to use this wonderful library so I'm still a little naive ^_^
Right now I'm having a problem that I have no idea how to solve. Documentation, google, etc have been useless for me in this point (probably because I'm not searching the right terms) So I'm creating an invitation system: simply, a form where you put an email address and when you hit submit it makes an ajax call. The server should answer with some data such 'how many invitations the user have left', possible errors and (if in development enviroment) the url for the invitation (debuggin purposes), everything coded in json. The problem is that sometimes when sending an invitation firefox pops me up with a download dialog suggesting to save an "application/json" file with all the data that the server processed. My jQuery script should be taking care of handling it and it is not. I have told Rails to render the answer in json format: render :json => message.to_json message is a hash with a format similar to {:error => "There was an error, sorry", :invitations_left => current_user.invitations_left} And I have also specified jQuery the type expected in the return of the call: function inviteFormXSubmit() { $.post('/invitations/create', {recipient_email: $("#recipient_email").val()}, createInvitationCallback, "json"); } So here is my problem. Any comment will be welcomed since I have no idea how to face this problem. Thx alot everybody. Alex