Is there a way I can wait for my ajax call?

Is there a way I can wait for my ajax call?

even polling approach is acceptable. but I don't know how to do it with $.ajax();
I need to wait for the result of that ajax call so that to determine the size of a panel for the return content.

may I check the status of the XmlHttpRequest object just like plain old ajax?
I can't do everything in the callback because I need some other parameter to invoke the panel to be shown.