[jQuery] Waiting on ajax request before form submit

[jQuery] Waiting on ajax request before form submit


I have a form.
Before submit it I would like send ajax request.
Based on the ajax request answer I would like to send form or not.
How can I do this?
Code:
$("#invoice_form").submit(function() {
$.get("/test", function(data) {
console.log("get answer");
});
console.log("sending form");
});
Now I see:
sending form
get answer,
and I would like to see:
get answer
sending form
so form will be sending before get request will be complete.
Can can I change? Can submit form can wait on complete get request?
Bober