Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. members.forEach(function(element) {
  2. //console.log(element);
  3. var out = [];
  4.  
  5. for (var key in element) {
  6. if (element.hasOwnProperty(key)) {
  7. out.push(key + '=' + encodeURIComponent(element[key]));
  8. }
  9. }
  10. var http = new XMLHttpRequest();
  11. var url = 'http://192.168.8.103:3902/api/member/add/admin';
  12. var params = out.join('&');
  13. http.open('POST', url, true);
  14.  
  15. //Send the proper header information along with the request
  16. http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  17.  
  18. http.onreadystatechange = function() {//Call a function when the state changes.
  19. if(http.readyState == 4 && http.status == 200) {
  20. console.log(http.responseText);
  21. }
  22. }
  23. http.send(params);
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement