help set ajax cookie Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
5 posters

    help set ajax cookie

    infotmt
    infotmt
    New Member


    Posts : 6
    Reputation : 1
    Language : english

    In progress help set ajax cookie

    Post by infotmt Sun 16 Jan - 21:36

    I have a code, I need to set a cookie for 30 minutes please help me
    Code:
    $(document).ready(function() {
        $("#newtopic").load("/f1- .ipbtable tbody tr .topictitle:lt(10)");
    });
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19325
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    In progress Re: help set ajax cookie

    Post by Ape Sun 16 Jan - 23:23

    @infotmt
    The topic was posted in the wrong section, so I have moved it to the correct section.
    Please read our forum rules: ESF General Rules



    help set ajax cookie Left1212help set ajax cookie Center11help set ajax cookie Right112
    help set ajax cookie Ape_b110
    help set ajax cookie Ape1010
    Niko
    Niko
    Helper
    Helper


    Male Posts : 3231
    Reputation : 248
    Language : English, Italian, French
    Location : Italy

    In progress Re: help set ajax cookie

    Post by Niko Mon 17 Jan - 1:47

    Dear @infotmt

    are you sure you are talking about cookies? Maybe you are referring to "cache", so that the result is stored in cache and not loaded every time? (in order to have a faster load on your website)

    Have a nice day :rose:

    infotmt likes this post

    zzlasperpen
    zzlasperpen
    Forumember


    Male Posts : 56
    Reputation : 3
    Language : VietNam

    In progress Re: help set ajax cookie

    Post by zzlasperpen Mon 17 Jan - 6:14

    I need it too
    infotmt
    infotmt
    New Member


    Posts : 6
    Reputation : 1
    Language : english

    In progress Re: help set ajax cookie

    Post by infotmt Mon 17 Jan - 6:34

    Niko wrote:Dear @infotmt

    are you sure you are talking about cookies? Maybe you are referring to "cache", so that the result is stored in cache and not loaded every time? (in order to have a faster load on your website)

    Have a nice day :rose:
    you are right, please help me
    TheCrow
    TheCrow
    Manager
    Manager


    Male Posts : 6916
    Reputation : 795
    Language : Greek, English

    In progress Re: help set ajax cookie

    Post by TheCrow Mon 17 Jan - 7:08

    @infotmt,

    Your topic is not clear enough. Please provide us with some more details as to what this code will do and maybe a screenshot with it.

    TC.



    help set ajax cookie Thecro10
    Forum of the Forums

    Forumotion Rules | Tips & Tricks |
    FAQ | Did you forget your password?



    *** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
    No support via PM!

    infotmt likes this post

    infotmt
    infotmt
    New Member


    Posts : 6
    Reputation : 1
    Language : english

    In progress Re: help set ajax cookie

    Post by infotmt Mon 17 Jan - 7:24

    @TheCrow
    I mean
    jquery .load so I want it to cache so that next time I don't need to reload

    @Niko You said exactly what I meant

    Niko likes this post

    Niko
    Niko
    Helper
    Helper


    Male Posts : 3231
    Reputation : 248
    Language : English, Italian, French
    Location : Italy

    In progress Re: help set ajax cookie

    Post by Niko Mon 17 Jan - 14:57

    @infotmt Here I am Wink

    I needed to change the script you provided because sadly in jQuery the function
    Code:
    .load()
    does not directly have cache support. For this reason we will turn this into
    Code:
    $.ajax


    Go to ACP > Modules > HTML & Javascript > Javascript codes management and create a new javascript with these settings, upon having verified that Javascript management is enabled:

    • Title: as you prefer
    • Where: in all pages (or in any case where the
      Code:
      #newtopic
      element is
      )
    • Code:
      Code:
      $(function() {
          var element = $("#newtopic");
          var targetPage = '/f1-';
          $.ajax({
                url: targetPage,
                cache: true,
                type:'GET',
                success: function(data){
                      var retrieveContent = $(data).find('.topictitle:lt(10)').html();
                      $(element).html(retrieveContent);
                }
          });
      });

    Ape likes this post