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 8569953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T18:27:08+00:00 2026-06-11T18:27:08+00:00

$.ajax({ dataType : html , url: jquery-loadMoreComments.php?lastComment=+ $(.postedComment:last).attr(‘id’)&section=+’.$sid.’, success: function(html) { I am having

  • 0
    $.ajax({
dataType : "html" ,
url: "jquery-loadMoreComments.php?lastComment="+ $(".postedComment:last").attr('id')&"section="+'.$sid.',   
success: function(html) {

I am having this ajax request from one file to other and I am retrieving the url variable in other file like this

$filtered = filter_input(INPUT_GET, "lastComment", FILTER_SANITIZE_URL);
$filtered1 = filter_input(INPUT_GET, "section", FILTER_SANITIZE_URL);

The first variable gets retrieved properly but the second variable is not getting to the other file. And $sid is retrieved by the first file from the url and then is sent via ajax to the second file to continue the request.

I changed the url to this

    url: "jquery-loadMoreComments.php?lastComment="+ $(".postedComment:last").attr('id'),section: '<?= $sid ; ?>',  

then in the second php file to retrieve the $sid I have written this

$filtered = filter_input(INPUT_GET, "section", FILTER_SANITIZE_URL);

but still it is not executing . I think the $sid variable is not passed properly. In the first php file I have not written any code to pass the variabl $sid, how can I do that.

  • 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-11T18:27:09+00:00Added an answer on June 11, 2026 at 6:27 pm

    I suspect the problem is with '.$sid' at the end of the URL. You’re probably expecting that to be replaced with the PHP variable, but this doesn’t look like a context where replacement happens.

    To make the replacement happen, you need to get back into PHP processing mode, e.g.

    "&section=<?= $sid ?>",
    

    Also, rather than constructing the URL parameters by concatenating strings, use the data: parameter to $.ajax and supply an object. jQuery will construct the parameter string automatically for you, with proper URL-encoding. So it should be:

    $.ajax({
        dataType : "html" ,
        url: "jquery-loadMoreComments.php",
        data: {
            lastComment: $(".postedComment:last").attr("id"),
            section: '<?= $sid ?>'
        },
        success: function(html) {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

jQuery code: function ajaxsubmit(){ $.ajax({ url: /update, type: POST, dataType: html }).success(function(data) { $('#result').html(data);
I have a jQuery AJAX function like this: $.ajax({ url: 'crud/clients.php', dataType: 'json', type:
I have a very basic AJAX function in JQuery: $.ajax({ url: http://www.google.com, dataType: html,
$.ajax({ type: GET, url: pages.php, data: hash=+s, dataType: html, success: function(msg){ $('#main').append(msg); } Works
$('#post_form').submit(function() { $(#ajax_bar_loader).show(); $.ajax({ url: 'add.html', data: $('#post_form').serialize(), dataType: 'json', type: 'post', success: function(
$(document).ready(function() { $('#content').html(''); $.ajax({ url:'data.json', dataType: json, success: function(data) { $('#content').append('<p>'+data.rank+'</p>'); } });}); In
I have a simple $.ajax({ url: someUrl, method: 'get', dataType: 'html', success: function(data) {
I am using jquery ajax option data like this $.ajax({ type: 'post', url: '/shop_pos/index.php?route=module/cart/callback',
I'm sending a JSON object to PHP using jQuery via $.ajax({ url: myURL, type:
$.ajax({ type: GET, url: awards.xml, dataType: xml, success: parseXml }); function parseXml(xml) { I

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.