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

  • Home
  • SEARCH
  • 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 8370139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:50:30+00:00 2026-06-09T13:50:30+00:00

to add a jQuery event to an Ajax link in CakePHP I used the

  • 0

to add a jQuery event to an Ajax link in CakePHP I used the following way,

<?php echo $this->Js->link(TITLE, array('controller' => 'CONTROLLER', 'action' => 'ACTION'), array('update' => '#DIV_ID', 'class' => 'FixAjaxReload') ); ?>

which becomes a HTML link and the following JQuery

jQuery('a.FixAjaxReload').on('click', FUNCTION);

on the other hand I need to add an event to the link,

(function(){jQuery("body").on('click', 'a.FixAjaxReload', function(event){
        var linkTo = jQuery(this).attr('href');
        if (navigator.appName.indexOf("Internet Explorer") > 0) {
            window.location.hash = '!' + linkTo.replace(window.baseUrl, '/');
        } else {
            window.history.pushState('', linkTo, linkTo);
        }
});})();
  • I used the selector syntax in the second event, because the link might be loaded by ajax call
  • I used the other syntax in the first event(i.e. didn’t change the CakePHP way), because if I did the event will be called multiple times (no. of previous Ajax calls)

but some how they don’t work together

any ideas???

thanks in advance

  • 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-09T13:50:32+00:00Added an answer on June 9, 2026 at 1:50 pm

    thank you for your help

    I found the solution
    I edit the Cake Engine as follow,
    in JQueryEngineHelper file –> event function
    I replaced “return false;” with “event.preventDefault();”
    the Problem wasn’t conflict between the two syntax as I thought, It was the “return false;” statement preventing the next scripts from being executed

    thanks again

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

Sidebar

Related Questions

how can I add a wild card into this jquery bind event so that
I have this link: <a id='delete' href='/add/delete.php?iid=XXXXX'>#</a> And I want to pass it on
i am trying to add class on on-click jquery event for that i am
I was wondering if there is a way to add Jquery UI icons to
I get a 401 Unauthorized when my ajax is doing a POST event this
I can add a product to cart via GET with this link: <div id=add><a
jQuery has a really handy event binder called live() which will add events to
I've a cakePhp website, I use prototype for all the ajax stuff, and jQuery
I'm trying to create a add/remove favorite with jquery and php. The addfavorite function
I am having a couple of problems involving PHP & AJAX using jQuery. To

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.