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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:20:47+00:00 2026-05-22T16:20:47+00:00

Firstly, click a link will be having a ajax call and once it is

  • 0

Firstly, click a link will be having a ajax call and once it is returned success, will call another function…

//First Call
$(this).click(ajaxHandler);

function ajaxHandler(){
    var $obj = $(this);
    var urlLink = someURL;
    var data = "id=" + "123";

    // Unbind the ajax handler to prevent re-fire before ajax request completes
    $obj.unbind("click", ajaxHandler);

    $.ajax({
        url: urlLink,
        data: data,
        cache: false,
        success: function(resp){
            // Bind the new event handler
            $obj.bind("click", someFunction);

            // Fire click on Object
            $obj.click();
        },
        error: function(){
            // Put the ajax handler back so the user can try again if it fails
            $obj.bind("click", ajaxHandler);
        }
    });
}

Here, in “someFunction”, I am calling like,

someFunction: function(e){
    var evt = (e) ? e : window.event;
    var p = evt.target.name;
    var x = evt.pageX;
    var y = evt.pageY;
   ............
}

First time I am getting evt.pageX and evt.pageY is undefined. If I click on the link again, then giving the exact position.

I am getting data for evt.target.name for first time also.
These events are useful for tooltip.

Please, Help me how to identify the axis position for first time.
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-05-22T16:20:48+00:00Added an answer on May 22, 2026 at 4:20 pm

    It’s undefined the first time, because the click event is fired manually, not by the user clicking with the mouse. To work around it, you can call someFunction manually instead of triggering the event and you can pass the first call’s event variable through.

    //First Call
    $(this).click(ajaxHandler);
    
    function ajaxHandler(e){
        var $obj = $(this);
        var urlLink = someURL;
        var data = "id=" + "123";
    
        // Unbind the ajax handler to prevent re-fire before ajax request completes
        $obj.unbind("click", ajaxHandler);
    
        $.ajax({
            url: urlLink,
            data: data,
            cache: false,
            success: function(resp){
                // Bind the new event handler
                $obj.bind("click", someFunction);
    
                // call function in the context of $obj and pass through event variable
                someFunction.apply($obj[0],[e]);
            },
            error: function(){
                // Put the ajax handler back so the user can try again if it fails
                $obj.bind("click", ajaxHandler);
            }
        });
    }
    

    In someFunction you don’t have to do anything fancy with the event variable, jQuery normalises it for you:

    someFunction: function(evt){
        var p = evt.target.name;
        var x = evt.pageX;
        var y = evt.pageY;
       ............
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Ok, Firstly, if you click on the questions link at the top of this
I am having trouble with loading JSON into an app that im creating $(#load_basic).click(function(){
2 Questions, firstly I have this code: function Question(container, question_list, chosenAnswer) { this.container =
Firstly: I am totally a newbie for this kind of work. I have a
Firstly, I was wondering if there was some kind of built in function that
Firstly, I do not have any malicious intent out of this question. I would
Firstly I would just like to thank everyone for reading this and answering my
Firstly, let me say that I've been on this issue for pretty much 2
Firstly, there have some tag links in my main page. click each one, post
Firstly, I have a project with a Windows Form that references another project with

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.