Fixing ajax and adding alert to template