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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:12:55+00:00 2026-06-07T19:12:55+00:00

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

  • 0

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 data-app-id="88" class="btn" id="visit_site" style="right:22px; top:65px; padding:5px;z-index: -99999;">VISIT SITE</span>

</a>

and this jquery:

      (function($){
            $('#target_site_to_visit').live('click',function(event){
            event.preventDefault();
           var appName=$('#target_site_to_visit').attr('class');
          $.post('db/update_site_viewed.php',{ name:appName }, 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');
      }); })(jQuery);

A problem exists, whenever the button is clicked.. the post method is executed which puts the data into the database. But that only happens when the last line in jquery doesnt exist: document.location.href.. the redirection effects the post somehow..and doesnt probably doesnt give the post method to execute..resulting in no record being inserted to the db (or in other post method doesnt execute).. is it possible that that is the cause..cause the redirection does effect the execution of the post method

  • 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-07T19:12:57+00:00Added an answer on June 7, 2026 at 7:12 pm

    This will solve your problem

    <script type="text/javascript">
            $('#target_site_to_visit').live("click",function(event){
            event.preventDefault();
           var appName=$('#target_site_to_visit').attr('class');
          $.post('db/update_site_viewed.php',{ name:appName }, function(data){
    
         //    console.log("AppName: "+appName);
    
          },'html').error(function(data){
    
           //  console.log("Error: "+data.responseText);
          });
        //  document.location.href=$('#target_site_to_visit').attr('href');
      }); 
    

    But use .on() instead of .live().LIke

    <script type="text/javascript">
                $(document).on("click",'#target_site_to_visit',function(event){
                event.preventDefault();
               var appName=$('#target_site_to_visit').attr('class');
              $.post('db/update_site_viewed.php',{ name:appName }, function(data){
    
             //    console.log("AppName: "+appName);
    
              },'html').error(function(data){
    
               //  console.log("Error: "+data.responseText);
              });
            //  document.location.href=$('#target_site_to_visit').attr('href');
          }); 
       </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got this html: <table> <tr style=display:table-row><td>blah</td></tr> <tr style=display:none><td>blah</td></tr> <tr style=display:none><td>blah</td></tr> <tr style=display:table-row><td>blah</td></tr> <tr
I have this HTML code: <p>Hello <span class=hide style=display:none>there</span> jquery</p> <button class=toggle>Toggle</button> <p>Hello <span
I have some HTML like this <div id=topContainer> <div id=level1 style=display:none;> </div> <div id=level2
I have got this css: <style type=text/css> #heading{ margin:auto; background-color: brown; } </style> and
I've got this code: <html> <head> <style type=text/css> body { text-align: center; } #content
I've got this form: <form id=imageinputpopup class=suggestionsubmit style=display: none> <span>Add a thing!</span><br/> <label>url: </label><input
I have got this html: <div id=myDiv> <p class=readMore></p> <p class=readMore></p> <p class=readMore></p> </div>
I have got this text file with latitude and longitude values of different points
I have this hidden link, which is needed for other purposes: <span id=notitle style=display:
I've got this html (simplified) <div class=outer style=float:left> <div class=inner style=float:left> <div class=contained style=clear:both>...</div>

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.