Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. function cargarJugadores2(){
  2. var req = $.ajax({
  3. url:'http://zz27.infoucrso.com/WSS/WSJugador.svc/cargarJugadores',
  4. timeout : 10000,
  5. dataType : "jsonp"
  6. });
  7.  
  8. req.success(function(datos) {
  9. var nombre = JSON.stringify(datos.nombre);
  10. alert(nombre);
  11. ProcesarJugadores2(datos);
  12. });
  13.  
  14. req.error(function(){
  15. alert("No fue posible establecer conexión con el Web Service");
  16. });
  17. }
  18.  
  19. function ProcesarJugadores2(datos) {
  20. var radiobutton = '<input type="radio" name="radio-choice-h-2" id="radio" onclick="escribir()"><label for="radio" id="label">' +
  21. "</br>Nombre Jugador: " + this.nombre + " </br> Correo: " + this.correo + '</label>'
  22.  
  23. localStorage["correoSeleccionadoAmigo"] = this.correo;
  24.  
  25. $('#listaJugadores').append(radiobutton);
  26. $('[type=radio]').checkboxradio().trigger('create');
  27. $('#listaJugadores').controlgroup().trigger('create');
  28. }
  29.  
  30. [{
  31. "Activo": true,
  32. "contrasenna": "1",
  33. "correo": "alex@gmail.com",
  34. "nombre": "Alex"
  35. }, {
  36. "A‌​ctivo": true,
  37. "contrasenna": "1",
  38. "correo": "maria@gmail.com",
  39. "nombre": "Maria"
  40. }, {
  41. "Acti‌​vo": true,
  42. "contrasenna": "1",
  43. "correo": "pedro@gmail.com",
  44. "nombre": "Pedro"
  45. }]
  46.  
  47. var nombre = datos[index].nombre; //index will be array index.
  48. alert(nombre); //no need to stringify nombre as you're doing array lookup.
  49.  
  50. function ProcesarJugadores2(datos) {
  51. var radiobutton = '<input type="radio" name="radio-choice-h-2" id="radio" onclick="escribir()"><label for="radio" id="label">' +
  52. "</br>Nombre Jugador: " + datos.nombre + " </br> Correo: " + datos.correo + '</label>'
  53.  
  54. localStorage["correoSeleccionadoAmigo"] = datos.correo;
  55.  
  56. $('#listaJugadores').append(radiobutton);
  57. $('[type=radio]').checkboxradio().trigger('create');
  58. $('#listaJugadores').controlgroup().trigger('create');
  59. }
  60.  
  61. function cargarJugadores2(){
  62. var req = $.ajax({
  63. url:'http://zz27.infoucrso.com/WSS/WSJugador.svc/cargarJugadores',
  64. timeout : 10000,
  65. dataType : "jsonp"
  66. });
  67.  
  68. req.success(function(datos) {
  69. datos.map(ProcesarJugadores2);
  70. });
  71.  
  72. req.error(function(){
  73. alert("No fue posible establecer conexión con el Web Service");
  74. });
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement