A nitpick but you can extrack $('input#to_name') to a variable. Like you did for $remote. Then you don't have to repeat it all the time.