Here's the curl bash command that I'm currently using:
curl -d "username=UID&password=PASS" http://localhost:8080
I'm looking to convert this into an ajax request in Java Script. Could you guide me on how to do that?
This is what I have tried so far:
$.ajax({
url: 'http://localhost:8080',
type: 'POST',
data: 'username=' + form.username.value + '&password=PASS',
success: function (data) {
console.log(data);
},
error: function (data) {
console.log(data);
}
});
In this case, form.username.value contains UID, but it doesn't seem to be working as expected. It appears that the server isn't receiving the request. Any insights on this issue would be greatly appreciated.