Thanks, Leonardo. This seems being the right answer. However, I fail at replacing the $.post() request by the more general $.ajax().
Can you see any error in the manner I'm doing the ajax request ? (The corresponding $.post() code in my first message works fine.) $.ajax( async: false, type: "POST", url: cart_doc, data: {action: 'retrieve_opt', name: fieldName}, success: function (chosenOption) { // Some feedback about what happens. alert('Field'); alert(field.name); alert('Chosen option:'); alert(chosenOption); field.value=chosenOption; // Setting chosen option ! }, dataType: "text" );