我有这些 javascript 变量:
$('#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>');
这些变量“item.description”和“element.name”我想传入php函数。
常见php文件中的php函数:
function trsText ($text){ here language translation code }
现在我想在该函数中传递 js 参数来翻译它们,因为我很容易翻译 php 变量,但是这里的名称和描述来自 js 代码,所以我想在那个特定的 php 函数中传递它们。