ajax function now has proper locale url, refactoring