Answer the question
In order to leave comments, you need to log in
How can I prevent a page from being displayed that is not loaded via ajax?
Good day!
Maybe the question in the header is not quite correct, but I will try to describe the problem!
There is a page template on laravel blade
In which dynamic content is inserted via ajax. (html + data received from the controller)
Naturally, the content has no styles or other information (for example: forms, tables, etc.).
there are pages for editing user data /account/update
. at this address you can get a piece of html with some data.
Through ajax (code below) I load data into the main page template
$(document).ready(function() {
$('#menu a').click(function() {
var url = $(this).attr('href');
$.ajax({
url: url + '?link=1',
success: function(r){
$('#content').html(r);
}
});
if (url != window.location){
window.history.pushState(null, null, url);
}
return false;
});
$(window).bind('popstate', function() {
$.ajax({
url: location.pathname + '?link=1',
success: function(r){
$('#content').html(r);
}
});
});
});
site.ru/account/update
we get html code, without styles and everything else. Even if we redirect to this page after updating the data, we get the usual piece of code. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question