title: jquery - Failed to load resource: the server responded with a status of 404 ()
body: <p>I am new to using jquery and have an issue with the using it. I have the following included in the html:</p>
  
  <pre><code>    &lt;script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.2.4.js"&gt;&lt;/script&gt;
      &lt;script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.2.4.min.js"&gt;&lt;/script&gt;
      &lt;script src="resources/jquery/jquery.validate.js"&gt;&lt;/script&gt;
      &lt;script src="resources/jquery/jquery.validate.min.js"&gt;&lt;/script&gt;
      &lt;script src="resources/jquery/additional-methods.js"&gt;&lt;/script&gt;
      &lt;script src="resources/jquery/additional-methods.min.js"&gt;&lt;/script&gt;
      &lt;link href="resources/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet" /&gt;
      &lt;link href="resources/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css" rel="stylesheet" /&gt;
      &lt;script src="resources/bootstrap-3.3.7-dist/js/bootstrap.min.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>When I submit the post:</p>
  
  <pre><code>            submitHandler : function(contactForm) {
              //do something here
              //var frm = $('#contactForm');
              //alert($("#accountName").val());
  
              $.ajax({
                  type: "POST",
                  url: "LoginView",
                  cache: false,
                  data: $(contactForm).serialize(),
                  success: function(data){
                      if(data == "1"){
                          window.location.assign("SelectPerson.html");
                      }else{
                          $('#ajaxGetUserServletResponse').text(data);
                          $("#accountName").focus();
                      }
                      console.log('Submission was successful.');
                      console.log(data);
                  }
              });
  </code></pre>
  
  <p>I inspect the Chrome console at the following is displayed:</p>
  
  <pre><code>jquery-2.2.4.min.js:4 POST http://localhost:8080/AwardTracker_NJE/LoginView 404 ()
  send    @   jquery-2.2.4.min.js:4
  ajax    @   jquery-2.2.4.min.js:4
  submitHandler   @   login-ajax.js:31
  d   @   jquery.validate.min.js:4
  (anonymous) @   jquery.validate.min.js:4
  dispatch    @   jquery-2.2.4.min.js:3
  r.handle    @   jquery-2.2.4.min.js:3
  </code></pre>
  
  <p>In the Source I have jquery-2.2.4.min.js the the following is underlined in red:</p>
  
  <pre><code>try{h.send(b.hasContent&amp;&amp;b.data||null)}catch(i){if(c)throw i}},abort:function(){c&amp;&amp;c()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&amp;&amp;(a.cache=!1),a.crossDomain&amp;&amp;(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=n("&lt;script&gt;").prop({charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&amp;&amp;f("error"===a.type?404:200,a.type)}),d.head.appendChild(b[0])},abort:function(){c&amp;&amp;c()}}}});var Jb=[],Kb=/(=)\?(?=&amp;|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Jb.pop()||n.expando+"_"+kb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&amp;&amp;(Kb.test(b.url)?"url":"string"==typeof b.data&amp;&amp;0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&amp;&amp;Kb.test(b.data)&amp;&amp;"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Kb,"$1"+e):b.jsonp!==!1&amp;&amp;(b.url+=(lb.test(b.url)?"&amp;":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?n(a).removeProp(e):a[e]=f,b[e]&amp;&amp;(b.jsonpCallback=c.jsonpCallback,Jb.push(e)),g&amp;&amp;n.isFunction(f)&amp;&amp;f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&amp;&amp;(c=b,b=!1),b=b||d;var e=x.exec(a),f=!c&amp;&amp;[];return e?[b.createElement(e[1])]:(e=ca([a],b,f),f&amp;&amp;f.length&amp;&amp;n(f).remove(),n.merge([],e.childNodes))};var Lb=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&amp;&amp;Lb)return Lb.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h&gt;-1&amp;&amp;(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&amp;&amp;"object"==typeof b&amp;&amp;(e="POST"),g.length&gt;0&amp;&amp;n.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("&lt;div&gt;").append(n.parseHTML(a)).find(d):a)}).always(c&amp;&amp;function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};function Mb(a){return n.isWindow(a)?a:9===a.nodeType&amp;&amp;a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&amp;&amp;(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&amp;&amp;(f+i).indexOf("auto")&gt;-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&amp;&amp;(b=b.call(a,c,n.extend({},h))),null!=b.top&amp;&amp;(m.top=b.top-h.top+g),null!=b.left&amp;&amp;(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&amp;&amp;d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(e=d.getBoundingClientRect(),c=Mb(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&amp;&amp;"static"===n.css(a,"position"))a=a.offsetParent;return a||Ea})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;n.fn[a]=function(d){return K(this,function(a,d,e){var f=Mb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Ga(l.pixelPosition,function(a,c){return c?(c=Fa(a,b),Ba.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&amp;&amp;(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return K(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)},size:function(){return this.length}}),n.fn.andSelf=n.fn.addBack,"function"==typeof define&amp;&amp;define.amd&amp;&amp;define("jquery",[],function(){return n});var Nb=a.jQuery,Ob=a.$;return n.noConflict=function(b){return a.$===n&amp;&amp;(a.$=Ob),b&amp;&amp;a.jQuery===n&amp;&amp;(a.jQuery=Nb),n},b||(a.jQuery=a.$=n),n});
  </code></pre>
  
  <p>With the error message "Failed to load resource: the server responded with a status of 404 ()"</p>
  
  <p>​The network tab is:</p>
  
  <p><a href="https://i.stack.imgur.com/k9k3Z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k9k3Z.png" alt="enter image description here"></a></p>
  
  <p>The folder structure is:</p>
  
  <p><a href="https://i.stack.imgur.com/R7GY5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R7GY5.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/AnRkf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AnRkf.png" alt="enter image description here"></a></p>
  
  <p>My LoginView.java WebServlet is:</p>
  
  <pre><code>package client;    
  /**
   * The purpose of this View is to allow the account holder
   * to login to their account using an Account Name and password.
   */
  
  import java.io.IOException;
  import java.io.Serializable;
  import java.time.LocalDateTime;
  import java.time.format.DateTimeFormatter;
  import java.util.List;
  
  import javax.servlet.ServletException;
  import javax.servlet.annotation.WebServlet;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import server.MySQLConnection;
  import shared.AccountGroup;
  import shared.AccountCubAssociation;
  
  
  @WebServlet("/LoginView")
  public class LoginView extends HttpServlet implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      int loginAttempt = 0;
      int youthMembersLinked = 0;
      public String youthMemberID = null;
      public String nextView = "Next View";
  
      @Override
      public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
          String textBoxAccountName = request.getParameter("accountName"); // From bootstrap
          String passwordTextBox = request.getParameter("enterPassword"); // From bootstrap
          System.out.println("In Java.");
  
          // If the required details have been entered then search the database for a
          // match            
          AccountGroup accountGroup = MySQLConnection.authenticateAccountGroup(textBoxAccountName, passwordTextBox);
  
          //Validate the Account
          if (accountGroup != null) {
              //Authenticated
              System.out.println("Authenicated");
              if (accountGroup.getLevel() == null) {
                  response.getWriter().write("Your account has not yet been set up. Please contact your administrator.");
              }else{
                  if (accountGroup.getArchived() != null) {
                      response.getWriter().write("Your account has been archived. Please contact your administrator.");
                  }else{
                      if (accountGroup.getEnabled() == 0) {
                          response.getWriter().write("Your account has been disabled. Please contact your administrator.");
                      }else{
                          //Record login details
                          LocalDateTime date = LocalDateTime.now();
                          DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
                          String nowDateTime = date.format(dtf);
  
                          MySQLConnection.addUse(accountGroup.getAccountId(), nowDateTime, accountGroup.getLevel(), accountGroup.getGroupCountry(), accountGroup.getGroupState(),
                              accountGroup.getGroupRegion(), accountGroup.getGroupDistrict(), accountGroup.getGroupName(),
                              accountGroup.getGroupSection(), accountGroup.getGroupSubSection());                     
  
                          //Determine which view to display next
                          if (accountGroup.getLevel().equals("Youth Member")) {
                              //Get the Youth Member's ID and store it for the next view.
                              AccountCubAssociation accountCubAssociation = MySQLConnection.getAccountCubsAssociation(accountGroup.getAccountId());
  
                              //Determine if the account is linked to a Youth Member
                              if (accountCubAssociation == null) {
                                  youthMembersLinked = 0;
                                  response.getWriter().write("Your account is not linked. Please contact the Administrator.");
                              }else{
                                  //Store account information for securely passing between views
                                  MySQLConnection.setViewData(accountGroup.getAccountId(), accountGroup.getLevel(), accountCubAssociation.getCdId(), null, null, accountGroup.getScoutGroupId(),
                                          null, 0, accountGroup.getGroupSection(), null, null, null, null, accountGroup.getGroupNAS());
  
                                  //Go to next view
                                  if (accountGroup.getGroupSection().equals("Joey") || accountGroup.getGroupSection() == "Joey") {
                                      //Go to next view - JoeyAwardOverview.html
                                      response.getWriter().write("13");
                                  }else{
                                      if (accountGroup.getGroupSection().equals("Cub") || accountGroup.getGroupSection() == "Cub") {
                                          //Go to next view - AwardOverview.html
                                          response.getWriter().write("14");
                                      }else{
                                          if (accountGroup.getGroupSection().equals("Scout") || accountGroup.getGroupSection() == "Scout") {
                                              //Go to next view - ScoutAwardOverview.html
                                              response.getWriter().write("15");
                                          }
                                          if (accountGroup.getGroupSection().equals("Venturer") || accountGroup.getGroupSection() == "Venturer") {
                                              //Go to next view - VenturerAwardOverview.html
                                              response.getWriter().write("16");
                                          }
                                          if (accountGroup.getGroupSection().equals("Rover") || accountGroup.getGroupSection() == "Rover") {
                                              //Go to next view - RoverAwardOverview.html
                                              response.getWriter().write("17");
                                          }
                                      }
                                  }
                              }
                          } else {
                              if (accountGroup.getLevel().equals("Non-leader")) {
                                  //Determine if the account is linked to one Youth Member
                                  //If linked to one Youth Member then go to the view to display
                                  //If linked to more than one Youth Member then go to the view
                                  //to allow a Youth Member to be selected.
                                  List&lt;AccountCubAssociation&gt; accountCubAssociationList = MySQLConnection.listAccountCubsAssociation(accountGroup.getAccountId());
  
                                  if (accountCubAssociationList.isEmpty()) {
                                      youthMembersLinked = 0;
                                  }else{
                                      for (final AccountCubAssociation accountCubAssociation : accountCubAssociationList) {
                                          //If the account is linked to a Youth Member then record
                                          //the Youth Member ID and count how many as we want to go
                                          //directly to AccountOverviewView if there is only one
                                          //Youth Member and pass the Youth Member ID.
                                          youthMemberID = accountCubAssociation.getCdId();
                                          youthMembersLinked++;
                                      }
                                  }
  
                                  if (youthMembersLinked == 0) {
                                      response.getWriter().write("You do not have any Youth Members to view. Please contact the Administrator.");
                                  }else{
                                      if (youthMembersLinked == 1) {
                                          //Is a Non-leader with one Youth Member.
                                          //Store the LoginView data for use in subsequent Views.
                                          MySQLConnection.setViewData(accountGroup.getAccountId(), accountGroup.getLevel(), youthMemberID, null, null, accountGroup.getScoutGroupId(),
                                                  null, 0, accountGroup.getGroupSection(), null, null, null, null, accountGroup.getGroupNAS());
  
                                          //Go to next view
                                          if (accountGroup.getGroupSection().equals("Joey") || accountGroup.getGroupSection() == "Joey") {
                                              //Go to next view - JoeyAwardOverview.html
                                              response.getWriter().write("13");
                                          }else{
                                              if (accountGroup.getGroupSection().equals("Cub") || accountGroup.getGroupSection() == "Cub") {
                                                  //Go to next view - AwardOverview.html
                                                  response.getWriter().write("14");
                                              }else{
                                                  if (accountGroup.getGroupSection().equals("Scout") || accountGroup.getGroupSection() == "Scout") {
                                                      //Go to next view - ScoutAwardOverview.html
                                                      response.getWriter().write("15");
                                                  }
                                                  if (accountGroup.getGroupSection().equals("Venturer") || accountGroup.getGroupSection() == "Venturer") {
                                                      //Go to next view - VenturerAwardOverview.html
                                                      response.getWriter().write("16");
                                                  }
                                                  if (accountGroup.getGroupSection().equals("Rover") || accountGroup.getGroupSection() == "Rover") {
                                                      //Go to next view - RoverAwardOverview.html
                                                      response.getWriter().write("17");
                                                  }
                                              }
                                          }
                                      } else {
                                          //Is a Non-leader with more than one Youth Member.
                                          //Store the LoginView data for use in subsequent Views.
                                          MySQLConnection.setViewData(accountGroup.getAccountId(), accountGroup.getLevel(), null, null, null, accountGroup.getScoutGroupId(),
                                                  null, 0, accountGroup.getGroupSection(), null, null, null, null, accountGroup.getGroupNAS());
  
                                          //Go to next view - SelectPerson.html
                                          response.getWriter().write("1");
                                      }
                                  }
                              } else {
                                  //Is a Leader or Administrator.
                                  //Store the LoginView data for use in subsequent Views.
                                  //Store account information for securely passing between views
                                  MySQLConnection.setViewData(accountGroup.getAccountId(), accountGroup.getLevel(), null, null, null,
                                          accountGroup.getScoutGroupId(), null, 0, accountGroup.getGroupSection(), null, null, null, null, accountGroup.getGroupNAS());
                                  if (accountGroup.getLevel().equals("National")) {
                                      //National Leader Reporting - NationalOverview.html
                                      response.getWriter().write("12");
                                  }else{
                                      if (accountGroup.getLevel().equals("National-Section")) {
                                          //National Section Leader Reporting - NationalSectionOverview.html
                                          response.getWriter().write("11");
                                      }else{
                                          if (accountGroup.getLevel().equals("State")) {
                                              //State Leader Reporting - StateOverview.html
                                              response.getWriter().write("10");
                                          }else{
                                              if (accountGroup.getLevel().equals("State-Section")) {
                                                  //State Section Leader Reporting - StateSectionOverview.html
                                                  response.getWriter().write("9");
                                              }else{
                                                  if (accountGroup.getLevel().equals("Region")) {
                                                      //Region Leader Reporting - RegionOverview.html
                                                      response.getWriter().write("8");
                                                  }else{
                                                      if (accountGroup.getLevel().equals("Region-Section")) {
                                                          //Region Section Leader Reporting - RegionSectionOverview.html
                                                          response.getWriter().write("7");
                                                      }else{
                                                          if (accountGroup.getLevel().equals("District")) {
                                                              //District Leader Reporting - DistrictOverview.html
                                                              response.getWriter().write("6");
                                                          }else{
                                                              if (accountGroup.getLevel().equals("District-Section")) {
                                                                  //District Section Leader Reporting - ManagementOverview.html
                                                                  response.getWriter().write("5");
                                                              }else{
                                                                  if (accountGroup.getLevel().equals("Group-Leader")) {
                                                                      //Group Leader Reporting - GroupSummary.html
                                                                      response.getWriter().write("4");
                                                                  }else{
                                                                      if (accountGroup.getLevel().equals("Group-Treasurer")) {
                                                                          //Group Leader Reporting - TreasurerGroupSummary.html
                                                                          response.getWriter().write("3");
                                                                      }else{
                                                                          //Go to the view to select a Youth Member
                                                                          if (accountGroup.getGroupSection().equals("Joey") || accountGroup.getGroupSection() == "Joey"){
                                                                              //Joey Award update - JoeyAwardUpdate.html
                                                                              response.getWriter().write("2");
                                                                          }else{
                                                                              //Select a Youth Member - SelectPerson.html
                                                                              response.getWriter().write("1");
                                                                          }
                                                                      }
                                                                  }
                                                              }
                                                          }
                                                      }
                                                  }
                                              }
                                          }
                                      }
                                  }
                              }
                          }
                      }
                  }
              }
          } else {
              System.out.println("Invalid");
              loginAttempt++;
              if (loginAttempt &gt; 2){
                  MySQLConnection.disableAccount(textBoxAccountName, 0);
                  response.getWriter().write("To many attenpts - Account has been disabled.");
              }else{
                  response.getWriter().write("Incorrect Account name or Password entered.");
              }
          }
      }
  }
  </code></pre>