I'm new to AJAX and I want to generate a password over this API. I want to use AJAX but dont know exactly how and where to specify the parameters.
$.ajax({
url: 'https://passwordwolf.com/?length=10&upper=off&lower=off&special=off&exclude=012345&repeat=5',
dataType: "text json",
type: "POST",
data: {upper: off, lower: on, special: off},
success: function(jsonObject,status) {
console.log("function() ajaxPost : " + status);
}
});
Many Thanks, Pls don't hate my programming skills!
Having a look at their API:
GET
method, not POST
.https://passwordwolf.com/api/
(notice the /api
at the end).See demo below (it uses cors-anywhere to circunvent the CORS problem).
It also shows how to correctly use an object to set params.
var CORS = 'https://cors-anywhere.herokuapp.com/';
$.ajax({
url: CORS + 'https://passwordwolf.com/api/',
dataType: "json",
type: "GET",
data: {
length: 10,
upper: "off",
lower: "off",
special: "off",
exclude: "012345",
repeat: 5
},
success: function(jsonObject, status) {
console.log("ajax result: " + JSON.stringify(jsonObject));
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>