This one doesn't work on my revcms, the script in the openingpost does work. So could you stuck with that one and just change that one a little bit?
And by the way, these are 2 different script, can't put them in 1 script together:
<form method="post" id="profileForm">...