title: jQuery not defined + MVC4
body: <p>Im creating the below MVC view that has got some jquery script in it.
  However this script is not getting executed. Getting jQuery undefined error.</p>
  
  <p>I want to write including script directly in view instead of using layout page.</p>
  
  <p>Can somebody advise what am I doing wrong here?</p>
  
  <pre><code>@{
  ViewBag.Title = "FileUpload";
  }
  
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8" /&gt;
  &lt;title&gt;@ViewBag.Title - What up boyeez!&lt;/title&gt;
  &lt;meta name="viewport" content="width=device-width" /&gt;
  &lt;script src="~/Scripts/jquery-ui-1.10.0.min.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>
  </p>
  
  <pre><code>&lt;h2&gt;FileUpload&lt;/h2&gt;
  
  
  @using (Html.BeginForm("UploadFile", "FileUpload", FormMethod.Post, new { enctype =         "multipart/form-data" }))
  {
  @Html.ValidationSummary();
  &lt;ol&gt;
      &lt;li class="lifile"&gt;
          &lt;input type="file" id="fileToUpload" name="file" /&gt;
          &lt;span class="field-validation-error" id="spanfile"&gt;&lt;/span&gt;
      &lt;/li&gt;
  &lt;/ol&gt;
  &lt;input type="submit" id="btnSubmit"  value="Upload" /&gt;
  }
  &lt;/body&gt; 
  &lt;/html&gt;
  
     &lt;script type="text/jscript"&gt;
     (function ($) {
         function GetFileSize(fileid) {
          try {
              var fileSize = 0;
  
              if ($.browser.msie) {
                  var objFSO = new ActiveXObject("Scripting.FileSystemObject");
                  var filePath = $("#" + fileid)[0].value;
  
                  var objFile = objFSO.getFile(filePath);
  
                  var fileSize = objFile.size;
                  fileSize = fileSize / 1048576;
  
              }
              else {
                  fileSize = $("#", fileid)[0].files[0].size
                  fileSize = file / 1048576;
              }
  
              return fileSize;
  
          }
          catch (e) {
              alter("Error is: " + e);
          }
      }
  
      function getNameFromPath(strFilepath) {
          debugger;
  
          var objRE = new RegExp(/([^\/\\]+)$/);
          var strName = objRE.exec(strFilepath);
  
          if (strName == null) {
              return null;
          }
          else {
              return strName[0];
          }
      }
  
      $("#btnSubmit").live("click", function () {
          debugger;
          if ($('#fileToUpload').val == "") {
              $("#spanfile").html("Please upload file");
              return false;
          }
          else {
              return checkfile();
          }
      });
  
      function checkfile() {
          var file = getNameFromPath($("#fileToUpload").val());
  
          if (file != null) {
              var extension = file.subst((file.last('.') + 1));
  
              switch (extension) {
  
                  case 'jpg':
                  case 'png':
                  case 'gif':
                  case 'pdf':
                      flag = true;
                      break;
  
                  default:
                      flag = false;
              }
          }
  
          if (flag == false) {
              $("#spanfile").text("You can upload only jpg, png, gif, pdf extension file");
              return false;
          }
          else {
              var size = GetFileSize('fileToUpload');
  
              if (size &gt; 3) {
                  $("#spanfile").text("You can upload file up to 3 MB");
                  return false;
              }
              else {
                  $("#spanfile").text("");
              }
          }
      }
  
      $(function () {
          debugger;
          $("#fileToUpload").change(function () {
              checkfile();
          });
      });
     })(jQuery);
  </code></pre>
  
  <p></p>