jquery - js file not loading when parameter passed number are increase in url - c# -
i've created button in index.aspx linked master page.
in master page
<link rel="stylesheet" href="css/bootstrap-theme.min.css" /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script> <script type="text/javascript" src="js/bootstrap.min.js"></script> <script type="text/javascript" src="js/lay.js"></script>
in lay.js
$(document).ready(function () { $("#a").click(function () { window.location = "hello.aspx/dhc/12/po"; }); });
hello.aspx page loads next errors:
resource interpreted script transferred mime type text/html: "http://localhost:64173/hello.aspx/c/js/jquery-1.11.1.min.js". 12:9 resource interpreted script transferred mime type text/html: "http://localhost:64173/hello.aspx/c/js/bootstrap.min.js". 12:10 resource interpreted script transferred mime type text/html: "http://localhost:64173/hello.aspx/c/js/lay.js". 12:11 uncaught syntaxerror: unexpected token < jquery-1.11.1.min.js:3 uncaught syntaxerror: unexpected token < bootstrap.min.js:3 uncaught syntaxerror: unexpected token <
what error have done?
if add
<script type="text/javascript" src="../../js/bootstrap.min.js"></script> <script type="text/javascript" src="../../js/lay.js"></script>
then works, if increment number of parameters 3 4, 1 time again have add together dots (relative path) reach there. how can create independent of number of parameters passed.
tia
change css , js links utilize absolute paths rather relative:
<link rel="stylesheet" href="/css/bootstrap-theme.min.css" />
and
<script type="text/javascript" src="/js/bootstrap.min.js"></script> <script type="text/javascript" src="/js/lay.js"></script>
the leading /
signifies root of virtual server, , hence becomes independent of current script executing.
c# jquery html asp.net
No comments:
Post a Comment