I have developed a Rails app and now I'm trying to improve its security. There are some ajax on it and as I don't have much experience with jQuery and on one of the ajax requests, I have to redirect the user via javascript, is it a good practice? I would like to know if it's safe the implementation below and what is the risk that my app could be suffering too:
success: function(callback) {
if (callback.status == true) {
if (event.target.id == 'radar_occurrences')
window.location.href = '/radar/all'
else
window.location.href = '/radar/list'
}
else {
$("body").before("<p class='error'>Failure message.</p>");
flashError();
}
}
Thanks!