I'm using prototype to do an AJAX request. I want the script that follows this request to wait until the request is done before executing.

This is the core script:

function myScript() {
new Ajax.Request('test.php', {method: 'get', onComplete: function(requestResponse) {alert((++c)+' ajax script done')}, onException: function() {alert('exception')}});
alert((++c)+' non ajax script done');
Now, I want the message 'ajax script done' to precede the message 'non ajax script done'. As you can see for yourself here, it doesn't.

I've tried setting asynchronous to false, but this seems to stop the request dead in it's tracks. (All the request is currently returning is the number 1, so there's no problem there).

Is this even possible?