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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:13:34+00:00 2026-06-14T17:13:34+00:00

I am building an application in Code Igniter and am currently building some functionality

  • 0

I am building an application in Code Igniter and am currently building some functionality where a user can approve or deny a request on the page by clicking either a tick or a cross icon on the page. These icons are anchor tags.

The trouble I am having is passing an ID for that individual request to the AJAX form.
I would have no issue implementing this functionality in a form as I would simply use a hidden input field which would have it’s value saved in it set from the controller. There can be many of these requests but they would always have their own individual ID as it is looped through in the view.

As I am using anchor tags instead of a form I am not sure where I could store the id for that request in the markup.
Here is the code:

        <p><span class="bold">Authorise This Request?: </span></p>
            <p>
                <a href="" class="authorise" id="allow"><img src="/igniter/images/tick.png" /></a>
                <a href="" class="authorise" id="deny"><img src="/igniter/images/cross.png" /></a>
            </p>
        </div>
        <?php $i++; ?>
    <?php } ?>
</div>
<script type="text/javascript">
$(document).ready(function() {
    $('.authorise').click(function() {
        $.ajax({
            type: "POST",
            url: 'holiday_request/authoriseRequest',
            data: 'check=' + $(this).attr('id'),
            success: function(data) {

            }
        });
        return false;
    });
});
</script>

As you can see I use the ID of the input field to determine later on whether to allow or deny it. All I want to do is to be able to pass the ID for that request through which is currently in the controller, so adding ‘&id= blahblahblah’ onto the end of the URL variable in the AJAX call.

Is there a way I can do this without having to use a form instead of anchor tags?

  • 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-14T17:13:36+00:00Added an answer on June 14, 2026 at 5:13 pm

    You can use HTML5 data-* Attributes

    <a href="" class="authorise" data-id="1" data-check="allow"><img src="/igniter/images/tick.png" /></a>
    ...
    

    Then get the value and add it to ajax data parameter

    data: 'check=' + $(this).data('check') + '&id=' + $(this).data('id'),
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m building MVC3 code first application and to display data on my page I’m
I am currently building a web application for my work and you can add
I am building a application in codeigniter and is running in some issues with
I'm building an application with C# code. How do I get only the date
So I'm building an application that is going to do a ton of code
I'm building a simple code-first MVC 3 blog like application. My model has three
I am building some applications and decided it was time to run my code
I am using SFML, and I am building an application in Code::Blocks and mingw32.
I'm trying to start building a whole application using phpBB3 user system as a
When building application for x86, the following code works fine: #if defined _WIN32 #define

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.