fixed some errors but $.ajax call still causing an error