Taking away if/else for data page/autofilldata

Cant figure out why when theres nothing but the ajaz call its working
fine, but when i add if else it breaks