adding redirect when ajax request is complete, if it has an url