Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.26 KB | None | 0 0
  1. mostrar: function () {
  2. this.loader = true;
  3. // console.log(" #2 MOSTRAR");
  4.  
  5. //conteoInut = parseInt($("#conteo").val());
  6. $.ajax({
  7.  
  8. contentType: 'application/json; charset=utf-8"',
  9. dataType: 'json',
  10. cache: false,
  11. type: 'POST',
  12. url: ('Ajax.asp?rad=' + parseInt(this.radio1) + '&offsetq=' + app.limit),
  13. data: 1,
  14. success: function (e) {
  15.  
  16. console.log(" SUCCES AJAX");
  17.  
  18. if (app.radio1 == "0") {
  19. app.programas = e.programas;
  20. app.limit = 0;
  21. app.arrayClean = false;
  22. }
  23.  
  24. if (app.radio1 == "1") {
  25. //app.programas = app.programas;
  26. console.log(" RADIO = 1");
  27.  
  28. // $('#tema').remove();
  29. $("#conteo").val(e.conteo);
  30. app.limit = e.conteo;
  31.  
  32. $.each(e.programas, function (k, v) {
  33.  
  34. let programas2 =
  35. {
  36. id: v['id'],
  37. nombre: v['nombre']
  38. }
  39.  
  40.  
  41. app.programas.push(programas2);
  42.  
  43.  
  44. });
  45.  
  46.  
  47. app.mostrar();
  48. }
  49.  
  50.  
  51.  
  52. app.loader = false;
  53. },
  54.  
  55. failure: function (e) {
  56. console.log(e);
  57. console.log(" error AJAX");
  58.  
  59. app.loader = false;
  60. }
  61.  
  62. }).done( function() {
  63.  
  64.    // alert( 'Success!!' );
  65.  
  66. }).fail( function (jqXHR,  textStatus,  errorThrown)  {
  67.   console.log(textStatus,  errorThrown);
  68.  
  69. })
  70.  
  71. <% dim jsonStr
  72.  
  73. dim continuarFlag 'va a ser la flag para saber si seguir o nel '
  74. continuarFlag = 0
  75. jsonStr = "{""employees"":[{""firstName"":""John"", ""lastName"":""Doe""},{""firstName"":""Anna"", ""lastName"":""Smith""},{""firstName"":""Peter"",""lastName"":""Jones""}]}"
  76.  
  77. jsonCriston ="{""programas"":["
  78. %>
  79.  
  80. <% While ((Repeat1__numRows <> 0) AND (NOT SpReporteNovedadesGenerales.EOF))
  81. Aux = Aux + 1
  82. nombrePrograma= ""& cstr(SpReporteNovedadesGenerales.Fields.Item("te_Nombre").Value )
  83. if (NumFilas <> aux) then
  84. jsonCriston = jsonCriston+"{""id"":"""&SpReporteNovedadesGenerales.Fields.Item("te_IdTema").Value & """, ""nombre"":"""& nombrePrograma & """},"
  85. else
  86. jsonCriston = jsonCriston+"{""id"":"""&SpReporteNovedadesGenerales.Fields.Item("te_IdTema").Value & """, ""nombre"":"""& nombrePrograma & """}]"
  87. end if
  88.  
  89. Repeat1__index=Repeat1__index+1
  90. Repeat1__numRows=Repeat1__numRows-1
  91. SpReporteNovedadesGenerales.MoveNext()
  92. continuarFlag = 1
  93. Wend
  94. 'jsonCriston =jsonCriston+ "{""id"":""1"", ""nombre"":""Doe""}]}"
  95. jsonCriston =jsonCriston +",""conteo"":"""&(cdbl(request.QueryString("offsetq"))+Aux)&""", ""continuar"":"""&continuarFlag&"""}"
  96. Response.write(jsonCriston)
  97. %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement