Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. {"content":{"Matrícula_RH":"10555","UserDocLanguage":"pt_BR","UserEmailHTML":"true","UserProjects":"","UserQuotaDocument":"500","UserSpecialization":"","UserWorkflowGroup":"TI","UX-APP-COMPANY":"88303375000171_0240050312_RS","WCMUserLang":"pt_BR"},"message":{"message":"OK","detail":"OK","type":"INFO","errorCode":null}}
  2.  
  3. function executa() {
  4. var url = "http://10.0.0.1:8181/api/public/2.0/users/listData/teste";
  5. var xmlhttp = new XMLHttpRequest();
  6. xmlhttp.onreadystatechange=function()
  7. {
  8. if (xmlhttp.readyState==4 && xmlhttp.status==200){
  9. var json = JSON.parse(xmlhttp.responseText);
  10. var contador = json.length;
  11. alert(contador);
  12. }
  13. }
  14. xmlhttp.open("GET", url, true);
  15. xmlhttp.send();
  16. }
  17.  
  18. Uncaught SyntaxError: Unexpected token < in JSON at position 0
  19. at JSON.parse (<anonymous>)
  20. at XMLHttpRequest.xmlhttp.onreadystatechange (rest.html:17)
  21.  
  22. var json = JSON.parse(xmlhttp.responseText);
  23.  
  24. function executa_new() {
  25. $.ajax({
  26. type: 'GET',
  27. url: 'http://10.0.0.1:8181/api/public/2.0/users/listData/teste',
  28. dataType: 'jsonp',
  29. success: function() {
  30. console.info("foi");
  31. }, error: function(e){
  32. alert('Ocorreu um erro durante a chamada ' + e);
  33. }
  34. });
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement