خرید بک لینک

Vote count: 0

I have no idea why I am receiving a 302 status code on a javascript file added in my html code. The other javascript files in the same folder are being served fine with a status 200 code, so unsure what to even look for?

Here is the html:

$(document).ready(function(){
  console.log("js is being called");
      var submitButton = $('#loginSubmit');
    submitButton.click(function (ev) {
      alert("clciked submit");

        ev.preventDefault();

      userVal = $('#user').val();
      passwordVal = $('#password').val();
      var dataVal = {user: userVal, password: passwordVal };

        $.ajax({
            type: "POST",
            url: "/login",
            data: dataVal,
            success: function (data) {
                if(data.failOrSuccess === 1) {
                  alert("success");
                  window.location.href = "/next"
                } else {
                  alert("Incorrect credentials");
                }
                console.log("the data retued is " + JSON.stringify(data));
            }
        });
    });

 });

Here is the JS File:

$(document).ready(function(){
  console.log("js is being called");
      var submitButton = $('#loginSubmit');
    submitButton.click(function (ev) {
      alert("clciked submit");

        ev.preventDefault();

      userVal = $('#user').val();
      passwordVal = $('#password').val();
      var dataVal = {user: userVal, password: passwordVal };

        $.ajax({
            type: "POST",
            url: "/login",
            data: dataVal,
            success: function (data) {
                if(data.failOrSuccess === 1) {
                  alert("success");
                  window.location.href = "/adminDashboard"
                } else {
                  alert("Incorrect credentials");
                }
                console.log("the data retued is " + JSON.stringify(data));
            }
        });
    });

 });

Here is my nodejs app.js file:

var express = require('express');

var app = express();


// view engine setup
app.set('views', path.join(__diame, 'views'));
app.set('view engine', 'jade');

// uncomment after placing your favicon in /public
app.use(favicon(path.join(__diame, 'public', 'img/favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser(config.cookieSecret.secret));
app.use(express.static(path.join(__diame, 'public')));


//Admin
app.get('/admin', admin);
app.post('/adminLogin', admin);


//to redirect other added link addresses
app.use('/*', function(req, res){
  res.redirect('/');
});


// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
  res.status(err.status || 500);
  res.render('error', {
    message: err.message,
    error: {}
  });
});


module.exports = app;

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 13 فروردين 1395 ساعت: 14:21

صفحه بندی