Given this html fragment
<div class="row">
<div class="col-md-12">
<pre><code id="sourcecode" class="python">print "Hello World"</code></pre>
</div>
</div>
I try to change the actual displayed code on the fly, e.g.:
$.ajax({
type: 'GET',
url: '/api/1/strategy/source/json/{{ name }}',
dataType: "json",
success: function (response) {
console.log(response);
$("#sourcecode").textContent = response;
}
})
Unfortunately it doesn't work. Any hints for me? (in the console log I see the correct response)
Thomas
Have a look into the below example, specifically the success function inside your
$.ajax
function.As long as the response is valid HTML, the
h1js
code should be working.