问题
SyntaxError: missing ) after argument list
i am new using dynamic field and append , i want to show option that i get from my database, the option dropdown is laoded but there is an error SyntaxError: missing ) after argument list
here is my code:
<script>
$(document).ready(function(){
var i=1;
$('#add').click(function(){
i++;
$('#dynamic_field').append('<tr id="row'+i+'" valign="middle" style="height:45px;">\
<td width="10%" style="text-align:right; padding-right:20px;">\
<select class="form-control" id="type" name="type" onchange="">\
<?php
while ($rowType = mysql_fetch_array($resultQueryType))
{
echo "<option value='".$rowType['type_name']."'>".$rowType['type_name']." </option>";
}
?>\
</select>\
</td>\
<td width="35%">\
<select class="form-control" id="antenna" name="antenna" onchange="">\
<option value="">-- None --</option>\
</select>\
</td>\
<td width="15%" style="padding-left:20px;">\
<select class="form-control" id="antenna_qty" name="antenna_qty" onchange="">\
<?php test(); ?>\
</select>\
</td>\
<td width="15%" style="text-align:center;"><label>0</label></td>\
<td width="15%" style="text-align:center;"><label>0</label></td>\
<td><center><button type="button" name="remove" id="'+i+'" class="btn btn-danger btn_remove">X</button></center></td>\
</tr>');
});
$(document).on('click', '.btn_remove', function(){
var button_id = $(this).attr("id");
$('#row'+button_id+'').remove();
});
$('#submit').click(function(){
$.ajax({
url:"name.php",
method:"POST",
data:$('#add_name').serialize(),
success:function(data)
{
alert(data);
$('#add_name')[0].reset();
}
});
});
});
</script>
here is screenshoot web browser said syntaxerror: missing )
did i do wrong?
来源:https://stackoverflow.com/questions/44402535/syntaxerror-missing-after-argument-list-in-dynamic-field-web-browser