• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 317
  • Last Modified:

ASP 0138 errors

Hi, Trying to get this script working in a Classic ASP page but getting ASP 0138 errors.

		<!--[if !IE]> -->

		<script type="text/javascript">
			window.jQuery || document.write("<script src='assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='assets/js/jquery-1.10.2.min.js'>"+"<"+"/script>");
</script>
<![endif]-->

		<script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>

Open in new window

0
Gareth_Pointon
Asked:
Gareth_Pointon
  • 4
  • 4
1 Solution
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
The code you have shown would not produce that error.  What is the exact asp error, line number?  Can you provide your code sample (including asp code)

For reference  http://classicasp.aspfaq.com/general/why-do-i-get-asp-0138-errors.html
0
 
Gareth_PointonAuthor Commented:
Hi,

I cannot make scenes of that.. I tried that but it didn't work.
script.rtf
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
I should have explained it better. The link I gave you for that error explains you can't have a script run inside of a script.   That is just a clue.    I don't see any asp code in what you provided.  

An example is this bit of code.  

<script type="text/javascript">
			window.jQuery || document.write("<script src='assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
		</script>

Open in new window

How come you are not just using
<script src='assets/js/jquery-2.0.3.min.js'>

Open in new window

If you want to detect jquery, I think you can do it like below instead.  
if (window.jQuery) {  
    // jQuery is loaded  
} else {
    // jQuery is not loaded
}

Open in new window



Also, probably unrelated but it looks like you have code for a templating engine but I don't see where you are loading anything like mustache.
<script type="text/javascript">
				try{ace.settings.check('navbar' , 'fixed')}catch(e){}
			</script>

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Gareth_PointonAuthor Commented:
Hi,

It was a template I brought online and yes I think thats what the developer was using on this dynamic paging.

However it also have basic HTML pages that you can then use in any coding type you like (so I'm told). I was staring to learn ASP.Net #C but don't have the time at the moment so wanted to take this template and use it for the current Classic ASP site.
0
 
Gareth_PointonAuthor Commented:
Am I doing something completely wrong as just cannot get this to work.
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
as a shot in the dark, try breaking up your end </script> tag a little more, instead of on the slash:

window.jQuery || document.write("<script src='assets/js/jquery-2.0.3.min.js'>"+"</sc"+"ript>");
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
This is all you need
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>


<!DOCTYPE html>
<html>
<head>
  <link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>

</body>
</html>

Open in new window

From there add your own style sheet(s) and js references.  In this sample, I am using the jquery cdn but you can load from your own server.

Then just add your template code.

Keep this
			<div class="navbar-container" id="navbar-container">
				<div class="navbar-header pull-left">
					<a href="#" class="navbar-brand">
						<small>
							<i class="icon-leaf"></i>
							Ace Admin
						</small>
					</a><!-- /.brand -->
				</div><!-- /.navbar-header -->

Open in new window

Change this type of code
 
<script type="text/javascript">
			if("ontouchend" in document) document.write("<script src='assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
		</script>
		<script src="assets/js/bootstrap.min.js"></script>
		<script src="assets/js/typeahead-bs2.min.js"></script>

Open in new window

to
 
<script type="text/javascript">
			<script src='assets/js/jquery.mobile.custom.min.js'></script>
		
		<script src="assets/js/bootstrap.min.js"></script>
		<script src="assets/js/typeahead-bs2.min.js"></script>

Open in new window

You can detect mobile browsers through jquery with http://detectmobilebrowsers.com/ or even better, just use bootstrap http://getbootstrap.com/ or foundation http://foundation.zurb.com/.  However, since you already have a template, that may just confuse the issue.  

You will just have to adjust your template for asp.  Think of it as straight html and just use your asp for dynamic content.
0
 
Gareth_PointonAuthor Commented:
Thanks.  It was the ' needed to be "

Thanks for the help.
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Glad it worked.

One note, that final code should have the top line taken out leaving only the calls to the js files.
<script src='assets/js/jquery.mobile.custom.min.js'></script>

<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/typeahead-bs2.min.js"></script>

Open in new window

0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now