I am having issues with syntax . I want to insert a PHP code inside JavaScript. And an error occurs, can anybody help me with this ?
this is the error,
var data1 = $('#assignedWeight').val("<h3>" + <?php echo number_format(data[0]['id'],2); ?> + "<sup style='font-size: 20px'>Kg</sup></h3><p>TOTAL PROJECT WEIGHT ASSIGNED</p>").val();
The original JS is like this,
showData.push(data[i]["id"]);
var data1 = $('#assignedWeight').val(data[0]['id']).val();
$('#assignedWeight').text(data1);
and i want to insert this code inside the val() in line 2
<h3>
<?php echo number_format($totalAssignedWeight,2); ?><sup style="font-size: 20px">Kg</sup>
</h3>
<p>TOTAL PROJECT WEIGHT ASSIGNED</p>
and the number_format in order to make the layout correct. Do you have any other suggestion ?