0👍
You should draw your chart inside the success function, ajax calls are asynchronous by nature, so the only other alternative is to make the call with async: false , which is a really bad idea (your ui will be frozen untill the server responds).
Also give us something we can work with for a better answer, not much can be understood from what you are presenting
Source:stackexchange.com