Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7735573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:32:07+00:00 2026-06-01T07:32:07+00:00

Seems simple enough. I’m creating a search engine that returns results to the user

  • 0

Seems simple enough. I’m creating a search engine that returns results to the user in paginated fashion. Each result is displayed in a list, and if the user clicks on any particular result, it expands out accordion-style and shows them some more information.

I’d like to implement some learning in my search rankings, so I’m going to be tracking which results the user clicks on, and the order in which they’re clicked.

I can already track clicks on one page. Each time the user clicks on a result, it is stored in a database with all the information I need.

Here’s my problem: If the user goes to the next page of results, I lose the current click count. I’m counting the clicks using jQuery – each time the user clicks a result, the click count increases, and the result, the result’s actual rank in the list, and the current click count is added to the database as a single row.

So how can I hold onto the click count?

Here’s my click function, where js/clicklog.php is where the query is sent to the database:

var order = 0;
$(document).ready(function() { 
    alert(order);
    $('.accordionButton').click(function(e) {
        if($(this).next().is(':hidden') == true) {
            $(this).addClass('on');
            $(this).next().slideDown('normal');
            $(this).next().slideDown(test_accordion);

            order++;
            var actualOrder = $(this).find("h3").eq(0).text();
            var major = $(this).find("h3").eq(2).text();
            var sessionID = $("#sessionID").text();

            $.post("js/clicklog.php", {sessionID:sessionID, major:major, actualOrder:actualOrder, order:order});
    } 

The sessionID is being pulled from a hidden div on the page, which is set from $_SESSION[‘id’]. I imagine I could maybe do something similar for the click count?

I understand WHY it’s not working, but I just can’t think of a solution of how to fix it since I’m still pretty new to jQuery, PHP, and AJAX.

If necessary, please let me know if there is any other code that you wish for me to post.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:32:09+00:00Added an answer on June 1, 2026 at 7:32 am

    You could put it into a PHP session variable

    <?php
    session_start();
    
    if(isset($_SESSION['views']))
    {
    $_SESSION['views']=$_SESSION['views']+1;
    }
    else
    {
    $_SESSION['views']=1;
    echo "Views=". $_SESSION['views'];
    }
    ?>
    

    You could probably send to the clicklog.php file where you would have the session variable and increment it and then return it how you are returning sessionID

    update from comment
    What you need to do is send a ajax request in your jquery

     var count = 2;
         $.ajax({
       type: "GET",
       url: "some.php",
       data: ({'count' : count}),
       success: function(msg){
         alert( "Data Saved: " + msg );
       }
     });
    

    Then receive it via post method or get if you choose that way instead and then process adding 1 to variable and returning it. hint whatever the php echos becomes msg.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That seems simple enough, but all Django Queries seems to be 'SELECT *' How
Seems simple enough - I'm creating one master NSMutableDic and filling it with more
Awesome Stackoverflow users, I am having difficulty with something that seems simple enough to
This seems simple enough, but I'm stuck. I have a View Controller that respondes
Well, it seems simple enough, but I can't find a way to add a
Seems like a simple enough question but I can't seem to find the answer.
Seems simple enough but I'm having some issues, I tried using preg_replace: preg_replace(<br />,
the documentation seems simple enough, but in practice, this feature is not working! I
Computing a running average of a simple 1-D data vector seems simple enough. Indeed,
Seems simple enough, but there doesn't seem to be a delete method on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.