Element works, but not on wordpress site [duplicate]

To avoid conflict, WordPress requires you to use jQuery instead of $. So, in your code, you should replace $.ajax() with jQuery.ajax() and $('ul') with jQuery('ul').

You can notice there are syntax errors in your browser’s console, such as:

Error: $.ajax is not defined