Difficulty using tokens with Ajax

Sorry to bother you, but for several days I have tried all the methods that the security token work with AJAX I do not know if I am, but do not use AJAX when the token is working properly.
It might in some way, a method was found and included in the documentation as this has so far been a great challenge to find this solution.