require() doesnt reload code example
Example: refresh javascript using require
<body>
<p id="contents">Nothing loaded.</p>
<button id="reload">Reload</button>
<script>
require.config({
baseUrl: "./js",
paths: {
jquery: '//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min',
}
});
require(["jquery"], function ($) {
var $contents = $("#contents");
function reload() {
require.undef("text!../file.html");
require(["text!../file.html"], function (file) {
$contents.empty();
$contents.append(file);
});
}
$("#reload").click(reload);
});
</script>
</body>