Tested theroy, if else breaks ajax. Not sure why