Keep your javascript / php files clearly separated in your mind. Even when asking questions.
"What would I use to display a message while waiting for ajax response?"
The browser will initiate the request using javascript. Thus, if you want to show something before you get an answer, the message has to already reside in the browser.
But assuming a good connection to your server and the slow response time is due to time consuming processing server side for the actual request, you could send a pre-request fetching a waiting message should this provide you with functionality you want.
Either way, you cannot include this information in the same request for which you are awaiting a response. Using jQuery I'm guessing you could
$.ajax({)).success(handleResult).failure(removeWaitingStatus).always($('#elm').html('waiting'););
But you will have to check the jQuery docs to see if "always" is guaranteed to always run before success. Otherwise you risk having your success function execute first, and then have always telling the user that you are waiting for a response that already was handled.
I'm guessing the above would work, but if it doesn't, first set the wait state, then issue the request.
$('#elm').html('waiting');
$.ajax();
The last way of doing things can easily be implemented without jQuery. Replace $.ajax() with whatever you do to handle the ajax request. And replace $('#elm').html with document.getElementById and innerHTML, while being super-aware of any browser inconsistencies on innerHTML. Should such still exist among your targeted browser pool.