You have to get it from an appropriate callback. The $.post() is asynchronous. Here is an example:
// Get some values from elements on the page:
var $form = $( this ),
term = $form.find( "input[name='s']" ).val(),
url = $form.attr( "action" );
// Send the data using post
var posting = $.post( url, { s: term } );
// Put the results in a div
posting.done(function( data ) {
var content = $( data ).find( "#content" );
$( "#result" ).empty().append( content );
});
From jQuery documentation here: http://api.jquery.com/jquery.post/
Also, I wouldn't recommend Dontfeedthecode's suggestion. Synchronous mode should never be used in javascript because it has unintended effects like locking up parts of the user interface. It might be OK for testing or particular circumstances, but I thought I should mention this disclaimer.