title: Passing username and password in ajax call
body: <p>I want to send a username and password in an ajax call. I realize its a not a good practice. But for testing at the time being, I have to do that. </p>
  
  <p>My code so far:</p>
  
  <pre><code>$.ajax({
      url: $(this).attr('action'),
      type: 'POST',
      data: $(this).serialize(),
      data: {username: "user", password: "password"},
      success: function(data){
      //var data = JSON.parse(jsondata);
      console.log(data);
      },
     });
  </code></pre>
  
  <p>But I run into 401 error everytime. Is there a way I can fix it?</p>