I'm doing some tests with ajax and php and I'm having a problem.
I proceed to comment:
I have a page antecedentes.php
which has a button add categories, which calls the function in ajax add categories.
The function adds the category but the issue is that when you receive the data, I need you to load in .load
the page antecedentes.php
+ la variable de usuario
that created that category, since I have a SQL query in antecedentes.php
that lists me categories according to idpersona
.
The code of the function is like this:
function agregardatoscategoria(idpersona,nombre,descripcion){
cadena="idpersona=" + idpersona +
"&nombre=" + nombre +
"&descripcion=" + descripcion;
$.ajax({
type:"POST",
url:"php/agregarDatosCategoria.php",
data:cadena,
success:function(r){
if(r==1){
$('').load('antecedentes.php');
alertify.success("agregado con exito :)");
}else{
alertify.error("Fallo el servidor :(");
}
}
});
In .load
I would have to load antecedentes.php?id=idpersona
but I do not know how to pass the variable.
I hope some answers and have raised my question well. Thank you very much!