Fix the JS by putting it in the success ajax method