Alternate way of solving problem using ajax redirect