It's impossible.
Javascript runs in the user interface thread; if your code is waiting for a server response, the browser should remain frozen.
Instead, you need to return the value with a callback:
function get_char_val(merk, callback)
{
var returnValue = null;
$.ajax({
type: "POST",
url: "char_info2.php",
data: { name: merk },
dataType: "html",
success: function(data) {
callback(data);
}
});
}
get_char_val('x', function(px) { ... });
get_char_val('y', function(py) { ... });
, .
, AJAX.
, , , JSON, { x: "...", y: "..." }.