Enhanced example code to include an ajax post