Keyword

K2 caching and ajax "POST" request in Chrome/ Edge

More
3 years 5 months ago - 3 years 5 months ago #177360 by Ralf
Hello,

I´ve some problems with the K2 integrated cache system.

I include the following jquery/ ajax script in a K2 item article.
$(document).ready(function() {
  $('#main_select').change(function() {
    $.ajax({
      url: "itemscript.php",
      type: "post",
      data: {
        option: $(this).val()
      },
      success: function(data) {
        $("#details").html(data);
      }
    });
  }).change();
});

The ajax generated content gets loaded correctly one time. After that the page is cached from K2 and the ajax content isn´t generated anymore.

Also I get the following error in chromes´ developers console:

jquery.min.js POST xyyy.com/itemscript.php net::ERR_CONNECTION_CLOSED


After I delete the joomla cache the ajax content is loaded correctly for one time. Also if I select the "Disable cache" option in chromes "Network" developers´ tools the ajax content is loaded correctly every time.

This problem only occurs in Chrome and Edge browsers. In other browers the ajax content gets executed correctly.

The "standard joomla cache system" is disabled.

Any tips how to solve this problem?

Thanks.
Last edit: 3 years 5 months ago by Ralf.

Please Log in or Create an account to join the conversation.

More
3 years 5 months ago #177370 by JoomlaWorks
Replied by JoomlaWorks on topic K2 caching and ajax "POST" request in Chrome/ Edge
Your JS code does a POST request (so Joomla would never respond using the cache, even if it was turned on).

How are you fetching the content exactly through PHP? In other words, what does "itemscript.php" actually do? If you can share its code, even better...

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum