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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:01:03+00:00 2026-05-27T04:01:03+00:00

Hello i am trying to modify the variable popText but failing on the ajax

  • 0

Hello i am trying to modify the variable popText but failing on the ajax function, i cant get the output on popText 🙁

What am i doing wrong?

function nariTooltip(){

var popTime;
var fading;
var popboxIsActive = false;
var mouseIsHoverPopbox = false;
var popText;

//Using Event Delegation to cover late AJAX inserted DOM elements
//no need to recall function after each AJAX run

//Mouseenter / Mouseout
$("body").on(
    {
        mouseenter: function(e){

                $hoverElem = $(this);

                //Define Variables
                var popDelay = 250;
                    if ($hoverElem.attr("popdelay")){
                        var popDelay = $hoverElem.attr("popdelay");
                    }

                popTime = setTimeout(function() {

                    popText = $hoverElem.attr("poptext");
                        if ($hoverElem.next().hasClass("poptext")) {
                            popText = $hoverElem.next(".poptext").html();
                        }

                    var popAjax = $hoverElem.attr("popajax");
                    if (popAjax){

                        var popAjax = popAjax.split(':');
                        popAjaxType = popAjax[0];

                        if (popAjaxType == 'general')
                            {
                            popAjaxUrl = 'tooltip_gen.php';
                            }
                        else if (popAjaxType == 'item')
                            {
                            popAjaxUrl = 'tooltip_items.php';
                            }


                        if (popAjaxUrl){
                            $.ajax({ url: 'ajax/'+popAjaxUrl,
                            data: {id: popAjax[1]},
                            type: 'get',
                            success: function(output) 
                                {
                                popText = output;
                                },
                            error:function (xhr, ajaxOptions, thrownError){
                                 popText =  html(xhr.statusText);
                                 },
                            });
                            }


                    //alert(outputs);
                    }

                    //Create Popup
                    $hoverElem.append('<div class="popbox">' + popText + '</div>');

popText always end up with the value assigned on popText = $hoverElem.next(".poptext").html();

  • 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-27T04:01:04+00:00Added an answer on May 27, 2026 at 4:01 am

    It seems that you create the div with the text before ajax has returned. Make function that sets the popText and call it when you’ve got it from ajax

    function setPopText( elem, txt ) {
        $(elem).append('<div class="popbox">' + txt + '</div>')
    }
    

    And in your ajax

    success: function ( output ) {
        setPopText( $hoverElem, output );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to modify this example: http://developer.android.com/resources/tutorials/views/hello-gridview.html But instead of displaying images that
Hello im trying to achive the iphone list effect in AS3 but i cant
Hello i am trying to modify any string to a valid variable made with
Hello i was trying to modify an object form the values of another object
Hello im trying to echo only the 50 letters, but something in my code
hello i am trying a sqlite database tutorial to build, but its not working
Hello I am trying to create a custom expandable listview, but the documentation on
I'm trying to get my jQuery event callback to trigger correctly, but I can't
I've copy-pasted a function that I'm trying to modify. I'd like to make it
Hello I am trying to modify one of the default files that comes 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.