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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:08:57+00:00 2026-06-17T20:08:57+00:00

I am not sure why but jQuery is not passing parameters to PHP in

  • 0

I am not sure why but jQuery is not passing parameters to PHP in order to complete the load() function with specific data based on the parameters ID.

In short term, when a user clicks a link there is onclick which fires up photo_tab('.$row['id'].');

account.php HTML element

<li><a href="#!/photos" onclick="photo_tab('.$row['id'].');"><i class="icon-camera"></i> Photos</a></li>

In a sence the ID should be passed to the photo_tab (the script is included into page not on the page it self)

general.js

function photo_tab(user_id) {
    $('.ac-content').load('ajax/photos.php',{user_id:id});
} 

And photos/ page should be loaded which is a PHP page and based on the user_id value load photos from database associated with that user_id.

<?php
   if ($_GET['user_id'] == 2) {
      echo "WORKED!";
   } else {
      echo "FAILED!";
   } 

***this is the photos/ file located at ajax/photos.php with mod_rewrite to point
otherwise to just photos/ or photos

EDIT: 1 – Using full path instead of rewrite photos > ajax/photos.php does not work
2 – The ID is being passed and echoed onto page via $row[‘ID’];
3 – ajax/photos.php is using $_REQUEST

  • 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-17T20:08:58+00:00Added an answer on June 17, 2026 at 8:08 pm

    Try passing the data as a query string, like so:

    function photo_tab(user_id) {
        $('.ac-content').load('photos/','user_id='+id);
    } 
    

    EDIT:
    Giving this a second look, is that URL correct? It seems weird to have a relative URL.

    You should also make sure the generated markup is correct, is the row ID printing out in the source?

    EDIT 2:
    I set this up locally, this is working code, mimicking your file structure.

    //localhost/account.php

    <html>
    <head>
        <script src="http://code.jquery.com/jquery.min.js"></script>
        <script>
            function photo_tab(id) {
                $('.ac-content').load(
                    'ajax/photos.php',
                    { 'user_id': id }
                );
            }
        </script>
    </head>
    <body>
        <div class="ac-content"></div>
        <a href="#!/photos" onclick="photo_tab(3);"><i class="icon-camera"></i> Photos</a>
    </body>
    

    //localhost/ajax/photos.php

    <?php
    if (isset($_GET['user_id']) && $_GET['user_id'] == 2)
    {
        echo "WORKED!";
    }
    else
    {
        echo "FAILED!";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not sure why but jQuery find function is not able to find
Not sure what I'm doing wrong but I can't get my JQuery AJAX call
I am not sure if this is specific to Firefox 11 & 12 but
I'm using jQuery but I'm not sure if it's easier with just Javascript. The
I am using D-Day calendar and I am not sure but I got a
I'm not totally sure but this looks wrong: I have a header file named
I know what i want but not sure of the name and required tools
I'm starting out with MVC but not sure it's the best option. I need
I am fairly new to MVC but not sure exactly which Redirect... replaces the
I'm not sure that title is worded very well, but not sure how else

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.