I have these javascript variables:
$('#modalDescription').html(item.description);
$('#exrtas-area-inside').append('<div class="custom-control custom-checkbox mb-3">
<input onclick="recalculatePrice('+id+');" class="custom-control-input" id="'+element.id+'"
name="extra" value="'+element.price+'" type="checkbox"><label class="custom-control-label"
for="'+element.id+'">'+element.name+' +'+element.priceFormated+'
</label></div>');
these variables "item.description" and "element.name" I want to pass in php function.
Php function which is in common php file:
function trsText ($text){ here language translation code }
now I want to pass the js parameters in that function to translate them, as I am translating php variables easily, but here name and description are coming from js code so I want to pass them in that particular php function.