Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML can't be the whole program

When I include the following js file (with jquery in it), I get the error in Firebug "XML can't be the whole program"

JS file include reference:

<script src="~/Scripts/scriptname.js" type="text/javascript"></script>

JS file contents:

$("[id*='txtAddress1S']")
  .blur(function(){
   $("[id*='txtAddress1S']")
      .val().match(
          /\b[p]*(ost)*\.*\s*[o|0]*(ffice)*\.*\s*b[o|0]x\b/i)&&
         (alert("Packages are not deliverable to a Post Office Box.
         \nPlease provide a different shipping address."),
    $("[id*='txtAddress1S']").focus())
  });

Thanks in advance!

like image 328
s15199d Avatar asked Apr 19 '11 13:04

s15199d


1 Answers

It might be that your script src attribute is not properly understood with the ~ and being parsed as an empty <script> tag instead. Use the full path to the javascript file, or a path relative to the page it's loading on:

<script src="/full/path/to/Scripts/scriptname.js" type="text/javascript"></script>
<script src="../relative/to/Scripts/scriptname.js" type="text/javascript"></script>
like image 70
Michael Berkowski Avatar answered Sep 19 '22 17:09

Michael Berkowski