Custom menu with an AJAX call

Even with the async option to true, i have the same error. I don’t think the async option is the real problem here, but maybe i’m wrong.