This is a part of my WordPress PHP file code, in this I wrote a JavaScript code and I would like to display the names, images from the query. Names are displayed but images are not displaying, then I added get_template_directory_uri(), after adding get_template_directory_uri() it is showing error in console like this "Uncaught Syntax Error: missing ) after argument list". All images are stored in WordPress theme image folder. How to write javascript code to display images? Please Help me out from this problem.
Thanks.
function partyFunction(){
debugger;
$postdata = {};
$postdata["partyId"]=$("#partydropdown").val();
$.post('<?php echo get_template_directory_uri() ?
>/GetPartiesData.php',$postdata,function (data) {
debugger;
console.log(data);
var stringreplace = data.replace(/['"]+/g, '');
console.log(stringreplace);
var res = stringreplace.split(",");
console.log(res);
$("#partyBody").empty();
$("#partyBody").html('');
$("#partyBody").append("<tr>"+
"<td>"+res[1]+"</td>"+
"<td><img src='"+<?php echo get_template_directory_uri() ?
>/img/++res[2]+"' style='padding:5px;vertical-align: middle;border-style:
none;width:129px;height:109px;' ></td>"+
"<td><img src='"+res[3]+"' style='padding:5px;vertical-align:
middle;border-style: none;width:129px;height:109px;' ></td>"+
"<td><a href='"+res[4]+"' target='_blank'>click here</a></td>"+
"</tr>");
});
}