See ajax request url syntax error in javascript file - #2 by KenWhitesell for a brief explanation about .js
files and render
.
In your specific case, you could even return the desired url in the original response as part of the data being returned.