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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:28:01+00:00 2026-06-11T20:28:01+00:00

In my view im doing this : <?php if($user_can_write) {?> <a href=<?php echo base_url(‘backend_controllers/users/foo’)?>

  • 0

In my view im doing this :

<?php if($user_can_write) {?>
<a href=<?php echo base_url('backend_controllers/users/foo')?> style="text-decoration:none">
Add</a>
<?php } ?>

I pass variable $user_can_write from my controller , which is my implementation for access control, the strange part is whenever i refresh this page , ie this view , the anchor tag is executed , ie , the foo function in user controller is called and executed , every time !Basically the foo function increments the db by one row (adds row to the db), so this is really not practical for me that on every refresh the anchor tag executes

Now if i do this implementation in the view (alternate approach) :

<?php if($user_can_write) {?>
<a href='javascript:void(0);' onclick="on_click_method_for_anchor()" style="text-decoration:none">
Add</a>
<?php } ?>

and further in my javascript i do this :

function on_click_method_for_anchor(){
$.ajax({
            url: '<?php echo base_url('backend_controllers/user/foo'); ?>',            
            type: 'POST',
            success: function(result){                
                $('.my_span_tag_class').html(result)
            }
        });

this seems to work perfect , and even if i reload the page , the foo is not called , can someone please tell me why is the anchor tag behaving like this ? am i missing out something obvious ?

  • 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-11T20:28:02+00:00Added an answer on June 11, 2026 at 8:28 pm

    I think you miss the ” ” part just after href properties of anchor tag.

    <?php if($user_can_write) {?>
    <a href="<?php echo base_url('backend_controllers/users/foo')?>" style="text-decoration:none">
    Add</a>
    <?php } ?>
    

    Try this.
    I think it will be ok

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

Sidebar

Related Questions

I am using this in my viewregistration.php file <html> <head> <link rel=stylesheet type=text/css href=<?php
I have a view that's doing a fetch() to a collection and returning some
I'm working on a Snow Leopard app and I'm doing some view animations (swapping
I am doing a JBoss SEAM project and when I view a form I
I'm doing a basic select against a view. Unfortunately the result can be slow
i am doing an ajax call and i refresh a partial view. Inside the
We are doing a custom JIRA project now, for the view issues screen, we
What am I doing wrong? FGallery is not starting in thumbnail view? FotosGalleryViewController *vc
I would like to keep model binding when doing ajax calls from my view.
In My iphone Application,I am doing simple image animation in a View and in

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.