No need of that tag again. Simply concatenate the variable –
echo '<input type="hidden" id="'.$row["id"].'" value="' . $cats . '">'
Update
With jQuery –
var response = "The response after ajax request";
$('input[type="hidden"]').val(response); // Selector will depend on your code
8
solved Echo in echo [duplicate]