1

The last days I tried to figure out a solution for this issue which appeared since I updated the page to php 8.0. I'm not a pro and I have to admit that I don't understand all connections and, therefore, also not all post that are around in the internet.

I have a page that should dynamically load additional content when scrolled to bottom of the page:

            $(window).scroll(function() {
            
            if($(window).scrollTop() + $(window).height() > $(document).height() -50) {
                 
                var counter= parseInt($('#contentcounter').attr('value'));
                var query= $('#query').attr('value');
                
                $.ajax({
                    url: 'loadcontent_dynamically.php',
                    data:  ({counter: counter,
                            query: query}),
                    type: 'POST',
                    success: function (data) {
                        $('#content-container').append(data);
                        //document.getElementById('content-container').append(data);
                        $('#contentcounter').attr('value',counter +12); //increase input value 
                    }
                 });                         
               }
            });

The event listener starts the ajax request, but the console gives out an error 500:

strict-origin-when-cross-origin

Now I read already some posts here, here, here, and here and some others before and also tried to figure out what changed in php since the update, because it worked well before that.

From what I've read so far, the error occurs when I want to access a foreign server. However, the loadcontent_dynamicall.php is at the same folder as the index.php. It should load content from a database and return html content that should be appended to the current side. Since I am not requesting content from any foreign server, but just from the same folder in the webspace, I suspect that there might be a different reason, but I cannot figure it out.

However, I should say, that this page is on a subdomain that is forwarded to another folder than the main domain.

I'd be happy if someone could provide some help/solution/hint that points out the issue. If possible please in simple words ;)

If required I can also provide the loadcontent_dynamicall.php, but for space and overview reasons I skipp it thus far.

Maki
  • 109
  • 13
  • 1
    `strict-origin-when-cross-origin` is about whether the browser should send a referrer header, that in itself is not an _error_. If you are getting an actual 500 Internal Server Error somewhere - then your first action should be to go and check the error log. – CBroe Apr 11 '23 at 07:56
  • @CBroe thanks for your comment. That is exactly the hint I required.... It tells me something about an SQL syntax error. A bit weird, though, since it worked thus far... I'll go check that tonight.... – Maki Apr 12 '23 at 08:19
  • Yep that worked... Thanks @CBroe. Next time I know that I should have alook there first :) – Maki Apr 12 '23 at 18:42

0 Answers0