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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:56:01+00:00 2026-05-30T10:56:01+00:00

In the top part of my document I have this Jquery code: // RATING

  • 0

In the top part of my document I have this Jquery code:

// RATING 
$('.rateit').click(function(){
var position = $(this).position();
});

In the footer I have a ajax call:

  jQuery.ajax({
             url: frm.attr('action'), //your server side script
             data: frm.serialize(), //our data
             type: 'POST',
             success: function (data) {
            alert(position.left);
            },

The problem is that the alert box is not showing with the position. I have tested with alert('something'); and it works fine.

My real ajax call:

 jQuery.ajax({
     url: frm.attr('action'), //your server side script
     data: frm.serialize(), //our data
     type: 'POST',
     success: function (data) {
    $('.warning').fadeIn(500).css({display: 'block',
        position: 'absolute',
        left: position.left + 50,
        top: position.top - 25
    }).append('asdasdsadsad'),
    $(ri).next('.ratingcount').html('asdasdasd')
    },
     error: function (jxhr, msg, err) {
         alert(msg); //something went wrong.
     }
 });
  • 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-30T10:56:03+00:00Added an answer on May 30, 2026 at 10:56 am

    You declare position inside the anonymous function used as a click event handler. That means it won’t be in scope when you try to alert it (you will get a ReferenceError).

    You will need to declare position outside of the event handler function:

    var position;
    $('.rateit').click(function(){
        position = $(this).position();
    });
    

    However, you will still get an error if the click event handler hasn’t been executed when your alert runs, because position will be undefined and therefore won’t have a left property.

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

Sidebar

Related Questions

I have this script using jquery: $(document).ready(function() { $('.fotky,.video,.diskusia,.onas,.zbrane,.akcie,.tabroz,.tabburk,.tabhil,.tablest').append('<span class=hover></span>').each(function () { var $span
Hi in my html document I have a call to a jQuery function. The
I am very new to javascript and ajax/jquery and have been working on trying
I've just started looking at JQuery. I don't have any AJAX in my web
ok so i have this address for a part of my website, localhost:2001/?botid=Alice&template=alice and
I have just inherited some code and part of that code is to show
can javascript document.write head meta part for seo? I have dynamic pages, so I
I have a piece of jQuery code which - in theory - scrolls down
I have the following at the top of my document: <html class=js lang=en xml:lang=en
The top of my web.xml file looks like this: <?xml version=1.0 encoding=UTF-8?> <web-app xmlns=http://java.sun.com/xml/ns/j2ee

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.