473,239 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,239 software developers and data experts.

Prototype: Ajax.Request

Airslash
221 100+
Hello,

currently I have 2 functions thatI'm trying to get to work together. Both functions make use of the Prototype library.

The first function moves a div container with ID _tooltip on the screen. This element is positioned absolute and uses the clonePosition to get the coords from its caller (_parent) and then adds an offset to prevent overlap.
This function works.
Expand|Select|Wrap|Line Numbers
  1. function relocateTooltip(_tooltip, _parent, _order) {
  2.     // OffSet variables
  3.     var left = _parent.getWidth();
  4.     var top = 0;
  5.  
  6.     // Check the top offset. reposition if we're the last element.
  7.     if( _order == true) {
  8.         top = $(_parent).getHeight() - _tooltip.getHeight();
  9.     } else {
  10.         top = $(_parent).getHeight();
  11.     }
  12.  
  13.     // position our tooltip witht the calculated values
  14.     _tooltip.clonePosition(_parent, {
  15.         'offsetLeft': left,
  16.         'offsetTop': top
  17.     });
  18. }
  19.  
Now I'm trying to use a second function to fetch data from another page using an AJAX call. The idea behind this is to have a tooltip with live data.
The problem however is that the onSuccess statement never gets called. and the relocation function doesnt work.
If I put everything seperatly then it works, but relocation functions lacks data then.
Expand|Select|Wrap|Line Numbers
  1. function loadContent(_tooltip, _url, _caller, _order) {
  2.     new Ajax.Request(_url, {
  3.         method: 'get',
  4.         onSuccess: function(transport) {
  5.             _tooltip.innerHTML = transport.responseText;
  6. // this part is not working for some reason.
  7.             relocateTooltip(tooltip, _caller, _order);
  8.         },
  9.         onCreate: function(transport) {
  10.             _tooltip.innerHTML = '<img src="/images/tooltip/load_bar.gif" alt="Loading..." />';
  11.             relocateTooltip(tooltip, _caller, _order);
  12.         }
  13.     });
  14. }
  15.  
What I want to know is, how I can make my relocateTooltip call get the parameters from the original function call.
Feb 2 '09 #1
3 1583
acoder
16,027 Expert Mod 8TB
Should it not be _tooltip in place of tooltip?
Feb 2 '09 #2
Airslash
221 100+
yeah it's a typo I discovered after posting :p

Also managed to solve the problem. Was collecting the height of the wrong node.Need to drop down 2 levels
Feb 2 '09 #3
acoder
16,027 Expert Mod 8TB
Well. that's good. Glad you got it sorted.
Feb 2 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jean-Philippe Encausse | last post by:
Hi, I got 2 bugs using AJAX with ISO-8859-1: 1. While serializing form's value using prototype.js I lost accent ... because it use encodeURIComponent() function. I saw on google, for...
2
by: chuck | last post by:
Hi, Firstly, I don't know if this is just and isolated thing with the prototype.js library or is a problem in general with ajax calls with a '+' character, so i am posting it here. I am...
45
by: bigdadro | last post by:
I've created a new class using prototype.js. After I make the ajax.request all references to this.myClassMethodorVariable are lost. Does the ajax method blow out the object persistance? I'm fairly...
5
by: dougwig | last post by:
I'm trying to handle the scenario where a user's session times out and and their ajax request triggers a redirection by the webserver (302 error?). I'm using Prototype 1.4 and the my works great...
31
by: Tony | last post by:
I just noticed that prototype.js is one of the files in the Ajax.NET distribution - I'm pretty concerned about this. Does anyone know if this is the same "prototype.js" that is not well-liked...
5
by: Gerry Vandermaesen | last post by:
Hi, Does anyone have a freely available JavaScript JSON stringifier. So far my search has been in vain, the one offered on http://www.json.org/json.js does not seem to work for me.
4
by: ext237 | last post by:
Simple ajax call seems to have some issues in Firefox. The "onComplete:" is called BEFORE the response is returned by the call. Is there a coding issue or a work around? var ajax = new...
3
by: jacobstr | last post by:
I've noticed Object.extend used in a few different ways and I'm having trouble distinguishing why certain usages apply to a given situation. On line 804 Ajax.Base is defined as follows: ...
3
by: wendallsan | last post by:
Hi All, I've stumped myself writing an app that uses Prototype and a bit of PHP. Here is what I have: I have a custom class named Default_county_init_data that, upon initialization makes...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.