jQuery popover wont load second time-Collection of common programming errors
I am using this popover on my page: https://github.com/klaas4/jQuery.popover I have multiple instances of the popover with different content and triggers. This is my JavaScript that says what should happen when i press a link
$(".addWorker").popover({
title: "Worker",
content: "Laddar..."
});
$(".addWorker").click(function (event) {
event.preventDefault();
$(this).popover(
'ajax',
"/jobs/AddWorker?jobid=" + $(this).attr("id")
).popover('show');
});
$(".markAsFinished").popover({
title: "Finished",
content: "Laddar..."
});
$(".markAsFinished").click(function (e) {
e.preventDefault();
$(this).popover(
Uncaught TypeError: Object [object Object] has no method ‘popover’ (repeated 3 times) ‘ajax’, “/jobs/MarkAsFinished?jobid=” + $(this).parent().parent().attr(“data-jobid”) + “&userid=” + $(this).parent().parent().attr(“data-userid”) ).popover(‘show’); });
Now this works great the first time i click a link, and the popover shows up. The content is loaded and presentet within the popover. But then when i want to open up another popover (presses another link), it get’s stuck at “loading” and no content is loaded. The same link works great if i refresh the page. Chrome Developer Tools tells me the following:
Uncaught TypeError: Object [object Object] has no method 'popover'
I have no idea how to solve this, so any help is appreciated.
Originally posted 2013-11-15 09:08:37.