views:

273

answers:

2

Scenario:

Say I am on an invoice details page. I have a customer name label and I want to be able to load customer details into a popup tooltip on mouseover of the label.

The contents of this tooltip should come from the contents of a specific div on an external page, for example:

ExternalURL: Customers.aspx?CustomerID=224
ExternalDIV: CustomerDetail

So, the URL pulls up the details for a specific customer, and by passing the div name, I don't display the header or any extraneous information that would normally be displayed when doing a proper navigation to the page. The reason for wanting to call an external page is so I can popup customer details from any page with very little coding.

I swear I found a plugin that does this a few months ago but can't seem to track it down now....

+2  A: 

As long as that external page is on the same domain, you can do this using jQuery's ajax load function.

Par example:

$("#currentDiv").load("/Customers.aspx?CustomerID=224 #CustomerDetail");
bigmattyh
I don't have #currentDiv in my page though, so need a popup plugin...
tbone
From your question, it looked like your main concern was how to get the content. The .load() function will do exactly what you need. If you need a tooltip/popup, just do a google search for jQuery tooltip -- there are a couple of solutions out there that you could use.
bigmattyh
I've been doing lots of googling and have yet to find a jQuery plugin that can both a) Load an external URL, b) in a popup tooltip, and c) Show only the contents of a certain DIV
tbone
(a) and (c) are achieved with the .load() function. (b) is achieved through a tooltip plugin, any number of which you can find online. If you're looking for a plugin that does all three without you having to put forth any more effort than that, well... I don't know what to tell you. All the pieces are there for you to take advantage of. Give it a shot.
bigmattyh
Ah, ok.....I didn't realize that jQuery selectors (ie: #CustomerDetail in your example) were fully supported in the load function. This should make pretty much anything possible, thanks!!!
tbone
A: 

Might work:

http://rndnext.blogspot.com/2009/02/jquery-ajax-tooltip.html

He has the external page name (personajax.aspx) and div name (personPopupResult) hardcoded, but these could be passed as parameters, just as he is passing 'page' and 'guid' as parameters.

tbone