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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:03:26+00:00 2026-05-13T23:03:26+00:00

I am working on a php that application that uses ajax. On all the

  • 0

I am working on a php that application that uses ajax. On all the links where i want to get the link hijacked by jQuery I add the class ajaxlink directly into the link

<a class="someclass ajaxlink" href="somelocation1">goto1</a>
<a class="someclass ajaxlink" href="somelocation2">goto2</a>
<a class="someclass ajaxlink" href="somelocation3">goto1</a>

The javascript looks something like this

$('.ajax-link').click(function(){get link with ajax});

If the user has JavaScript enabled he will get the page trough ajax. One particular i have one multiple pages, so i have the same function to generate the same link for all the pages.

Now my problem is in just one of the links in one page i want to do something different. It has to fire another function when the ajax page return succesfull. Now I have a code like this.

<div class"specialclass">
    <a class="someclass ajaxlink" href="somelocation1">goto1</a>
    <a class="someclass ajaxlink" href="somelocation2">goto2</a>
    <a class="someclass ajaxlink" href="somelocation3">goto1</a>

    <a class="someclass ajaxlink special-1" href="somelocation">goto</a>
    <a class="someclass ajaxlink special-2" href="somelocation">goto</a>
    <a class="someclass ajaxlink special-3" href="somelocation">goto</a>
</div>

$('.ajax-link').click(function(){get link with ajax});
$('.specialclass .special-1,
   .specialclass .special-2,
   .specialclass .special-3').click(function(){get link with ajax});

This setup because i want the normal link that are in the same container to be executed as normal. Only one the special links i want to add another click event. I think i cant add this event to the normal click event, because it only has to fire in one specific page of the application. On all other pages it will be unnecessary code.

This setup however produced errors, because the specialclass click gets fired first, and after that the ajaxlink class. This has to be switched, it only has to fire if the ajaxlink returned a success.

Any one have any ideas on this.

  • 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-13T23:03:26+00:00Added an answer on May 13, 2026 at 11:03 pm

    You could refactor your normal click function out of the entire process and do this:

    var normalClick=function(){/*get link with ajax*/};
    
    $('.ajax-link').click(normalClick);
    $('.specialClass').click(
      function(){
        normalClick();
        /* special click code */
      }
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working to an application that uses jqGrid. The problem is that the
I've got an iframe application that's working fine and rendering fbml in facebook. But
I'm building my first application that requires a calendar. I have it working great
I'm developing an application for a client's website. Here's the story, this company uses
I ran into an interesting issue today when I was working on an application
I have a php script that I have used for years to force downloads
I'm developing a php application and need to test the functionality of sending emails.
How can I determine what add-ons to apache will be required for my php
I left this question as generic as possible, but I do have a specific
We currently use PDForm to grab a blank pdf file (no values, just form

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.