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

  • SEARCH
  • Home
  • 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 6328873
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:32:33+00:00 2026-05-24T17:32:33+00:00

I have a simple load more style script that works fine on the index

  • 0

I have a simple load more style script that works fine on the index page, where only one parameter is sent via ajax

    $(function() {//When the Dom is ready
    $('.load_more').live("click",function() {//If user clicks on hyperlink with class  name = load_more
        var last_msg_id = $(this).attr("id");//Get the id of this hyperlink this id indicate the row id in the database
        if(last_msg_id!='end'){//if  the hyperlink id is not equal to "end"
            $.ajax({//Make the Ajax Request
                type: "POST",
                url: "index_more.php",
                data: "lastmsg="+ last_msg_id,
                beforeSend:  function() {
                    $('a.load_more').html('<img src="loading.gif" />');//Loading image during the Ajax Request
                },
                success: function(html){//html = the server response html code
                    $("#more").remove();//Remove the div with id=more
                    $("ul#updates").append(html);//Append the html returned by the server .
                }
            });
        }
        return false;
    });
});

With this HTML/PHP

<div id="more">
 <a  id="<?php echo $msg_id; ?>" class="load_more" href="#">more</a>
</div>

However, I want to add another php variable so that it can also work with particular categories, I have no problems writing the HTML and PHP but I am new to Jquery and struggling to edit the script to include the additional parameter if it is set. This is the HTML that I am thinking of using, just struggling with editing the JQuery

<div id="more"class="<?php echo $cat_id;?>">
<a id="<?php echo $msg_id;?>" class="load_more2" href="#">more</a>
</div>

As always any help is much appreciated!

  • 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-05-24T17:32:34+00:00Added an answer on May 24, 2026 at 5:32 pm

    You can pass multiple URL params in the data portion of your ajax call.

    data: "lastmsg="+ last_msg_id +"&otherparam="+ other_param
    

    On the PHP side, you’d just process these as you already are.

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

Sidebar

Related Questions

Are ajax requests more resource-intensive than a normal page load? For example, I have
I have a hibernate class with more than one property, I have heard that
I have simple jsf page with view params and load method which is processing
I have a simple Chrome extension that uses the content script feature to modify
I have a simple web.py program to load data. In the server I don't
I have created a simple web-service using Java. i want to load jars related
I have simple win service, that executes few tasks periodically. How should I pass
I have simple HTML code with some JavaScript. It looks like: <html> <head> <script
I have a simple java maven project. One of my classes when executing needs
I have a simple system that refreshes a div every few seconds: $(document).ready(function() {

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.