added AJAX code, cross origin errors found