im making a form using jquery modal forms, the form has user info like Name, Last Name, etc.. im adding a new user via jquery .ajax and its working all fine, it adds the user to de db(mysql) and automatically adds it to a list of users that is being displayed, no problem at all here..
my list of users has an edit button, and when i press the button a modal submit form pops up with the info of that user. here's where my question pops, its doing it all fine, but when i click the edit button, the modal form pops and after 1 or 2 seconds the info of the user displays on the text fields,, is this actually good enough? or does it has to do it instantly? it kinda feels a little slow....
here is my ajax call for editing users:
$('body').on('click', '#listaUsuariosOK a', function (e){
e.preventDefault();
var accion = $($('#accion').val('editUser')).val();
var id = $($('#id_user').val($(this).attr('href'))).val();
$('#agregarUsuario').dialog('open');
$.ajax({
cache:false,
type: "POST",
dataType:"json",
url: CI.base_url + 'admin/agregarUsuario',
data: "&id=" + id + "&accion=" + accion,
success: function(response){
if(response.respuesta == 'error'){
//Display Error
}else{
$('#text_nombre').val(response.nombre);
$('#text_apellido').val(response.apellidos);
$('#text_email').val(response.email);
$('#depto').val(response.depto);
}
} //Success End
});//.ajax Ends
});//$('body') call Ends
i make a post call sending the id of the user to edit, then on my php I make the query for that id and return the data via json_encode()
How can i make the response time faster? thanks a lot in advance... (im new to ajax btw hehe)