Updated ajax code so it's in line with the new way of sending data