# Need help with AJAX partial not refreshing browser asking to save .js instead

**URL:** <https://www.ruby-forum.com/t/need-help-with-ajax-partial-not-refreshing-browser-asking-to-save-js-instead/149295>\
**Category:** Rails\
**Created:** [September 23, 2008, 11:00am UTC](https://www.ruby-forum.com/t/need-help-with-ajax-partial-not-refreshing-browser-asking-to-save-js-instead/149295 "2008-09-23T11:00:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tyliong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e9a140/32.png) [@tyliong](https://www.ruby-forum.com/u/tyliong)\
**Post date:** [September 23, 2008, 11:00am UTC](https://www.ruby-forum.com/t/need-help-with-ajax-partial-not-refreshing-browser-asking-to-save-js-instead/149295/1 "2008-09-23T11:00:32Z")

</div>

Hi, when i use the updatepassword action, it does not refresh the ajax  
partial but forces the browser to save a file  
why does that happen?

def updatepassword  
@user = current\_user  
return unless request.post?  
if User.authenticate(current\_user.login, params[:old\_password])  
if ((params[:password] == params[:password\_confirmation]) && !  
params[:password\_confirmation].blank?)  
current\_user.password\_confirmation =  
params[:password\_confirmation]  
current\_user.password = params[:password]  
if current\_user.save  
flash[:notice] = “Password successfully updated.”  
redirect\_to login\_path #profile\_url(current\_user.login)  
else  
flash[:error] = “An error occured, your password was  
not changed.”  
respond\_to do |format|  
format.js  
end  
end  
else  
flash[:error] = “New password does not match the  
password confirmation.”  
@old\_password = params[:old\_password]  
respond\_to do |format|  
format.js  
end  
end  
else  
flash[:error] = “Your old password is incorrect.”  
respond\_to do |format|  
format.js  
end  
end  
end

---

<div class="post-metadata">

**Author:** ![tyliong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e9a140/32.png) [@tyliong](https://www.ruby-forum.com/u/tyliong)\
**Post date:** [September 23, 2008, 1:59pm UTC](https://www.ruby-forum.com/t/need-help-with-ajax-partial-not-refreshing-browser-asking-to-save-js-instead/149295/2 "2008-09-23T13:59:51Z")

</div>

never mind i solved it
