Hi all,
Apologies in advance if this question has already been answered here
-- I've done a few searches of past posts and haven't found anything
directly relevant, but since I'm new to the group I may be overlooking
the obvious...
I have an exhibit on a group of authors and selected people who appear
in their work. At the moment, I have a map view that allows a user to
select an individual author on the map and then see some simple
information (dates of birth/death, location of birth/death, etc.) in
the popup. But I'd also like to be able to make a call to a web
service and append the response at the bottom of the popup. For
instance, I'd like to have a link that says something like "See works
by this author" that, when clicked by the user, queries our database
of texts and returns a list of books that can be appended after the
link.
That seems pretty straightforward to me, but everything I've tried has
failed miserably and I'm hoping folks here can give me some pointers
in the right direction. The exhibit is currently on a local machine,
so I can't post a link, but here's the code I have at the moment:
The relevant line in the exhibit lens that controls the map popups:
<a ex:content="if(contains(.personal_role, 'author'), 'Texts by this
author', ' ')" ex:id-subcontent="{{value}}" class="title-link"></a>
The {{value}} in question is the unique name authority id we've
assigned to the person, and can be used to query our internal
database. The output looks something like <a id="pwheatley.boe"
class="title-link"><span>Texts by this author</span></a>.
Then, using jQuery in no-conflict mode to handle the AJAX request,
I've tried to do something like this:
$("a.title-link").click(function() {
var nameKey = $(this).attr("id");
$.ajax({
type: "GET",
url: "name-lookup.php?key=" + nameKey,
success: function(data) {
$(this).next("p").append(data);
}
});
});
(The PHP that's being called is just a simple page that runs resolves
the unique name authority id to a particular set of title-level
records. Nothing special there.)
This method works flawlessly when I'm working with content that is
"outside" of the exhibit -- elements that are hard-coded into a page,
for example. But it doesn't work at all with content that's generated
within Exhibit (it just does nothing), which makes me think that I'm
missing something obvious in the way that jQuery interfaces with the
Exhibit components. Can anyone point me in the right direction on
this? Is there a better way to accomplish what I'm trying to do here?
I should also mention that I'm not wedded to using jQuery for
this...I've just grown accustomed to using it for other projects, so I
thought I would use it here as well.
Thanks in advance for the help!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---