Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dibawah ini javascript ajax, nah saya ingin mengubahnya menggunakan jquery, tp kenapa response http 415 terus ya:
- function loadDoc() {
- var user = document.getElementById('name').value;
- var password = document.getElementById('password').value;
- var xhttp = new XMLHttpRequest();
- xhttp.onreadystatechange = function() {
- if (xhttp.readyState == 4 && xhttp.status == 200) {
- document.getElementById("demo").innerHTML = xhttp.responseText;
- }
- };
- xhttp.open("POST", "http://localhost:8080/SecurityApi/system/login", true);
- xhttp.send(btoa(user + ":" + password));
- }
- ======================================================
- var dats = btoa($("#name").val() + ":" + $("#password").val() );
- $.ajax({
- url:"http://localhost:8080/SecurityApi/system/login",
- type:"POST",
- data:btoa($("#name").val() + ":" + $("#password").val() ),
- contentType:"application/json; charset=utf-8",
- dataType:"json",
- success: function(msg){ alert(msg) }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement