I made a function that is invoked for the lack of better words from a page, lets call it Page1, the function is called when a button is clicked, at the end of said function it calls another one that creates (or should seeing I haven't been able to test it) a html and appends it to a div with a #lista id.
The problem is that this div is another page (Page2), so I don't know if there is some syntax like in ajax where you specify where you want those values to go, so basically page 1 calls a function (on another file just in case) that function calls another and the result of that function goes on Page1 (another file, again just in case)
Here is my jQuery/JS code to further illustrate:
$("#btnAceptar").click(function() {
   var idlab = $('#txtNumLab').val(),
   capacidad = $('#txtCapacidad').val(),
   carrera = $('#txtCarrera').val(),
   ubicacion = $('#txtUbicacion').val();
  var request = $.ajax({
    url: "includes/functionsLabs.php",
    type: "post",
    data: {
     'call': 'addLab',
     'pIdLab':idlab,
     'pCapacidad':capacidad,
     'pCarrera':carrera,
     'pUbicacion':ubicacion},
    dataType: 'json',
      success: function(response){
        alert('exito')
    agregar();        
     }
  });
});
This function should affect a element with id #Lista on Page2.
function agregar(){
 var div = $( "#lista" ).append( "<div class='box'>
          <p>Lab #'numero'</p>                                  
          <p class='info'><a href='#' id='lnkInfo'>Info</p></a>
          <p class='info'><a href='reservarLab.html'>Reservar</p></a>
      </div>" );
div.id = querySelectorAll('#lista > div').length +1;
var numero = div.id;  
$('#numero').append(div); 
}
Thanks a lot in advance!
 
    