I am trying to execute a script dynamically inside a div using postscribe https://github.com/krux/postscribe/
Below is a snippet of code
<div id="searchBox1" style="float: left;">
</div>
<div id="searchBox2">
</div>
Here is the script
$.get("/api/service/Getscripts/", function (data) {
postscribe('#searchBox1', data.script1, {
done: function () {
console.log("1st success");
},
error: function () {
console.log("1st error");
}
});
postscribe('#searchBox2', data.script2, {
done: function () {
console.log("2nd success");
},
error: function () {
console.log("2nd error");
}
});
});
The above code only works for the first script, but it does not display the second. Please suggest?
source
share