I know this has been asked before. I have read the answer to the question here several times: How do I return the response from an asynchronous call?. I realize that I need to create a callback function to return the result. I'm not sure how to do that as explained here- How do I return the response from an asynchronous call? - but with parameters passed into the function as well (optionSelectionArray).
function simpleWithAttrPrice(optionSelectionArray){
var product_id= <?=$product_id ?>;
$j.ajax({
type: "POST",
url: "/ajax_calls/childrenToJs.php",
data: { 'productID': product_id, 'optionSelectionArray' : optionSelectionArray}
}).done(function(data) {
return price;
});
}