Hello, I have two functions in jQuery that when you click on the button btn_enviar
send the data to the database via AJAX.
I also have a $.get
that writes the data in HTML controls.
I would like to be able to send the data without refreshing the entire page, and only update the drivers.
This is the code I have:
$(document).ready(function (){
$.get("<?php echo base_url('obteneract') ?>","",function(data){
console.log(data);
var json1=JSON.parse(data);
var actividad="";
for(post in json1){
actividad+="<li>"+json1[post].Nombre+"</li>";
$("#actividades").html(actividad);
}
});
});
$("#btn_enviar").click(function(){
var data=$("#formulariocurso :input").serializeArray();
$.post($("#formulariocurso").attr("action"),data, function(info){
});
});
<input type="text" placeholder="Descripcion actividad" id="Actividad" name="Actividad" required>
<button class="button expanded" id="btn_enviar"> Registrar Curso </button>