1234567891011121314151617181920212223 |
- $("#go_login").click(function () {
- var url = "http://127.0.0.1:8000/login";
- var xhr = new XMLHttpRequest();
- xhr.open("POST", url);
- xhr.setRequestHeader("accept", "application/json");
- xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- xhr.onreadystatechange = function () {
- if (xhr.readyState === 4) {
- console.log(xhr.status);
- console.log(xhr.responseText);
- alert('登入成功')
- window.location.replace( "/index" )
- }
- };
- var data = "grant_type=&username="+$('#username').val()+"&password=qwe&scope=&client_id=&client_secret=";
- xhr.send(data);
- });
|