how can i make this code to return the value without freezing the browser.
You can rewrite this with new method of course.
function get_
You can not make variable assignments this way (async). you must set the variables in the success handler.
variableArray = new Array();
get_char_val('x');
get_char_val('y');
function get_char_val(merk)
{
var returnValue = null;
$.ajax({
type: "POST",
url: "char_info2.php",
data: { name: merk },
dataType: "html",
success: function(data)
{
variableArray[merk] = data;
}
});
}
Once all of the retrievals are finished you can access the x and y variables by using variableArray[x] and variableArray[y]