I'v been trying to make a post request with Javascript to slgg.de/api/login.php. It needs user and pwd as input and will the return the status a key and more to me. The response is then supposed to be processed on my external website. My current Code looks like this:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
<script>
$(document).ready(function() {
$.post("https://slgg.de/api/login.php", {
user: "MyName",
pwd: "MyPwd"
}, function(data, status) {
console.log(data);
});
});
</script>
edit: full code.
They are objects. Objects are in {"key": "value"}
pairs. Replace =
with :
and replace the alert
with console.log
so that you get a better idea of what's happening:
$(document).ready(function() {
$.post("https://slgg.de/api/login.php", {
user: "MyName",
pwd: "MyPwd"
}, function(data, status) {
console.log(data);
});
});
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.