I am loading a HTML template using the $.get function and I would like to parse this HTML and inject my own values into it. So far I have tried the below snippet, but it doesn't seem to be working.
$.get('/js/dynamic/locations', function(newRow) {
var existing_elem = $('.edit-table tr:last');
existing_elem.after(newRow);
var appendedRow = existing_elem;
appendedRow.find('td[data-th="Name"] > span').text(v.location_name);
appendedRow.find('input').val(v.location_name);
appendedRow.effect("highlight", {color: '#CCB4A5'}, 1000);
});
The value of newRow when loaded is:
<tr>
<td data-th="Name"><span class="edit-input-text"></span>
<input class="inp input-edit" type="text" name="location_name" value=""></td>
</tr>
v.location_nameand how do you then attach the HTML to the DOM?