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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:23:22+00:00 2026-06-07T15:23:22+00:00

I have got this html: <a href=http://www.google.com data-ref=su1c2cess class=Wifewriting id=target_site_to_visit> <span data-app-id=63 class=btn id=visit_site

  • 0

I have got this html:

<a href="http://www.google.com"  data-ref="su1c2cess" class="Wifewriting" id="target_site_to_visit">
    <span data-app-id="63" class="btn" id="visit_site" style="right:22px; top:65px; padding:5px;z-index: -99999;">VISIT SITE</span>
</a>

UPDATE
And this is my jQuery:

 $(document).ready(function(){
         $('body').on('click','#target_site_to_visit',function(event){
           var appName=$('#target_site_to_visit').attr('class');
           var referrer=$('#target_site_to_visit').attr('data-ref');
          $.post('db/update_site_viewed.php',{ name:appName, ref:referrer }, function(data){



      throw new Error("AppName: "+appName);

      },'html').error(function(data){

      throw new Error("Error: "+data.responseText);
      });
    // document.location.href=$('#target_site_to_visit').attr('href');
return false;
  });

});

The event.preventDefault(); does nothing in stopping the link from being triggered.. why?

  • 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-07T15:23:23+00:00Added an answer on June 7, 2026 at 3:23 pm

    As long as there are no errors in your console and valid markup, return false will prevent the event’s default action and prevent it from bubbling up the DOM as you know.

    $(document).ready(function(){
        $('body').on('click','#target_site_to_visit',function(event){
            var appName=$('#target_site_to_visit').attr('class');
            var referrer=$('#target_site_to_visit').attr('data-ref');
            $.post('db/update_site_viewed.php',{ name:appName, ref:referrer }, function(data){
                throw new Error("AppName: "+appName);
            }, 'html').error(function(data){
                throw new Error("Error: "+data.responseText);
            });
            return false;
        });
    });
    

    And to use the obtained data, use the first parameter in the $.post‘s callback function which returns the fetched data:

    $.post('db/update_site_viewed.php',{ name:appName, ref:referrer }, function(data){
            console.log(data); //<-- fetched html will be displayed in the console
    }, html);
    

    Inside the callback function you can use .html(), .append() and similar methods to add the data to the DOM, as well as being able to manipulate it as a string, get sub-elements of it by wrapping the data inside the a jQuery object $(data), and well, do basically everything you want with it.

    Reference

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

Sidebar

Related Questions

I have got this html: <a style=display:block; padding:100%; text-decoration: none; href=http://google.com class=Jasmin id=target_site_to_visit> <span
I have got this html on the page: <a href=review.asp?sitename=webcamking#video_embed class=tutorials data_site=webcamking>&nbsp;&nbsp;Tutorial 1</a> This
I have got this html: <div id=myDiv> <p class=readMore></p> <p class=readMore></p> <p class=readMore></p> </div>
I've got a string like this: I love @kevinrose 's new website <a href=http://kevinrose.com>Link</a>
I have got html as below <a href= data-href=/somefile.php?id=10&refcode=/test.php>Hello</a> and I need to replace
I have some html to popup a jQuery UI modal: <a href=my/url class=popup>Click me</a>
I got this HTML structure: <form> <input class=myTrigger type=radio value=1/> <input class=myTrigger type=radio value=2/>
I got this html <tr> <td> Main Alliase/Current Alliase: </td> <td><input type=text id=maina class=countchars
I have got this function that returns a constant..Here is my class and function:
I have got this code: function init(){ if (typeof window.jQuery !== 'function') { var

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.