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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.