Use $.ajax rather than $.post to handle errors when selecting a template