Answer the question
In order to leave comments, you need to log in
Getting a specific block via ajax?
Hello, I'm familiar with ajax not so long ago, please help)
I have the following code:
$('#filter_form').submit(function(e){
var str = $(this).serialize();
$.ajax({
type: "POST",
url: "./",
data: str,
success: function(result){
$('#users_wrap').html(result);
}
});
return false;
});
Answer the question
In order to leave comments, you need to log in
$('#users_wrap').html(result); replace with - console.log($('main').html());
I will be a telepath.
Through the grid, the block id must be specified. I could be wrong, but the load method is needed.
$( "#result" ).load( "ajax/test.html #container" );
We need a separate file that will give only main. You can make the page itself be empty at first, but at the end of the download, the ajax request for this separate file would automatically leave. to get unfiltered data. Further, when entering data into the filter form, you can make ajax requests to the same separate file and replace the page content.
However, a slightly better way would be to include unfiltered content in the page at the stage of its generation.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question