I have an ajax
call which gets a string contains script from the backend. Now I want to add this string to a script tag at runtime.
$.ajax({
type: "GET",
url: "Users/_getScript",
contentType: "application/json; charset=utf-8",
cache: false,
success: function (data) {
script = data;
console.log(script);
}
});
say script
is a global variable which now contains code from backend.
Note: There is no URL from which I want to load external js. I want to add a string variable.