Keyword

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

More
3 weeks 1 day ago - 3 weeks 1 day 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 weeks 1 day ago by Ralf.

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

  • Fotis
  • Fotis's Avatar
  • Online
  • Administrator
  • JoomlaWorks Support Team
More
2 weeks 6 days ago #177370 by Fotis
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...

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

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


Powered by Kunena Forum