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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:45:40+00:00 2026-05-15T20:45:40+00:00

I have the following link- <a href=ex.com onClick=return popitup2(‘<?php echo $var3; ?>’);>Grab Coupon</a> Where

  • 0

I have the following link-

<a href="ex.com" onClick="return popitup2('<?php echo $var3; ?>');">Grab Coupon</a>

Where i have initialized $var3 like this

$var3 = "brand1,camp2";

The code for the function popitup2() is –

<script language="javascript" type="text/javascript">
function popitup2(id) {
$.ajax({
   url: "http://jainkunal.com/wordpress/wp-content/trackclicks/clickcounter.php"+"?"+id,
   success: function(){
     alert( "Data Saved: " );
   }
 });
    newwindow2=window.open('','name','height=225,width=350');   
var tmp = newwindow2.document;

….some more code…
…at end…

    return true;
}
</script>

Now when i click the link ex.com opens up without any alert i.e without running the php script through ajax and the javascript after that. If i remove the ajax call from the function popitup2() then the remaining javascript gets executed correctly.

  • 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-15T20:45:40+00:00Added an answer on May 15, 2026 at 8:45 pm

    Agree with previous answer that you are executing asynchronous Ajax request.
    From documentation Async parameter may not work in 2 cases: Cross-domain requests or if dataType: “jsonp”.
    If you are doing crossdomain request, I can suggest only:

    <a href="ex.com" onClick="return popitup2('<?php echo $var3; ?>', this);">Grab Coupon</a>
    <script type="text/javascript">
    function popitup2(id, link) {
      $.ajax({
        url: "http://jainkunal.com/wordpress/wp-content/trackclicks/clickcounter.php"+"?"+id,
        context: link,
        success: function(){
          alert( "Data Saved: " );
          window.location = $(this).attr("href");
       }
      ....
      return false;
    });
    

    With such approach we track clicking for sure.
    There is another problem with such approaches, that tracking server should be fast otherwise, user will wait long time till navigate to resource.

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

Sidebar

Related Questions

I have the following link which opens a jquery modal window: <div id='confirm-dialog'><a href='#'
Say I have the following link: <li class=hook> <a href=i_have_underscores>I_have_underscores</a> </li> How would I,
SO I have the following set of code parsing delicious information. It prints data
SO I have the following set of code parsing delicious information. It prints data
In oscommerce, I have set the DIR_WS_IMAGES from the config.php to be an external
I have following code structure, where i am trying to change the css file
I have been parsing xml content using the xmlreader and cannot use the xml
I have a page that loads content via ajax. When I click on a
I am trying to get all the text between the following tags and it
I'm trying to write code that talks to Google Spreadsheets. We do a bunch

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.