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.
My code so far:
$.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); }, }); But I run into 401 error everytime. Is there a way I can fix it?