0
My problem is,
I have a table that displays the information you have in the database registered information in the index. And in the index you have the option to add a new record (Modal Ajax) in the file editaagenda.php
has all forms (CRUD) when returns success .done()
in ajax I call the editaagenda.php
to update the hmtl table with the updated information need to display the list the data in the index without giving reflesh on the page.
And the only way that came to mind was after insertion take the file with the $.get and play on div . read_content of the index instead of the other to update without reflesh.
My code:
$.ajax({
url: 'add-data.php',
cache: false,
contentType: false,
processData: false,
data: dados,
type: 'post'
}).done(function (data) {
$('#addfrm').modal('hide');
$('#frm')[0].reset();
$.get("editaagenda.php?#read_content", {}, function (data, status) {
$(".read_content").html(data);
});
It would be this way for it to return only the part of the code in the file editaagenda.php
where you have div with id="read_content",
but this way I did it is returning all page instead of only Div with id="read_content".
Why not modify PHP to only return what you need? This will decrease the payload of your communication and make the data transmitted faster between client and server.
– Woss
I edited the question better, to better understand what I am doing. And see if really this is the right way.
– JB_