refresh javascript using require

JavaScript
<body>
  <p id="contents">Nothing loaded.</p>
  <button id="reload">Reload</button>
  <script>
    require.config({	// require's configuration
        baseUrl: "./js",
        paths: {
            jquery: '//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min', // file path
        }
    });
    require(["jquery"], function ($) {
        var $contents = $("#contents");
        function reload() {
            require.undef("text!../file.html");				 // "clear" the required code
            require(["text!../file.html"], function (file) { // re-require the code
                $contents.empty();		// your optional code (can be omitted) by just using:
                $contents.append(file); // require(["text!../file.html"]);
            });
        }
        $("#reload").click(reload);  // call the refresh function in a button or another function
    });
  </script>
</body>
Source

Also in JavaScript: