I am trying to load JQuery library from a JavaScript file and calling a function that is using JQuery.
JS1.js
$(document).ready(function () {
//var id = 728;
(function () {
var jq = document.createElement('script'); jq.type = 'text/javascript';
jq.src = '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(jq);
})();
ShowData('test');
});
Markup:
<head runat="server">
<title></title>
<script src="JS/js1.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div id="embedloc">
</div>
</form>
</body>
But its not working. The function is still unable to find the JQuery. When I am adding it manually on the HTML page, it runs successfully. Please help.