Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Ajax question

I'm using this code to get the tooltip.
The tipped shows the correct information when the page is opened. If the ToDate value is changed, I get two tipped messages. The original one and the one with the new dates on top of it.
$(document).ready(function() {
var fromDate = $("#x_FromDate").val()
var toDate = $("#x_ToDate").val()
var tipElement = '#el_tblReservations_License'
Tipped.create(tipElement, {ajax: {url:'ajaxLicenseLookup.asp', type:'GET', data:{strFrom:fromDate, strTo:toDate}, success:function(msg) {return msg;},
},
title: 'These Licenses are already
reserved for your dates',
showOn: 'click',
close: true,
hideOn: false,
position: 'right',
cache: false,
skin: 'gray'
});
//If the end date is changed
$("input[name='x_ToDate']").change(function(){
var fromDate = $("#x_FromDate").val()
var toDate = $("#x_ToDate").val()
Tipped.create(tipElement, {ajax: {url:'ajaxLicenseLookup.asp', type:'GET', data:{strFrom:fromDate, strTo:toDate}, success:function(msg) {return msg;},
},
title: 'These Licenses are already
reserved for your dates',
showOn: 'click',
close: true,
hideOn: false,
position: 'right',
cache: false,
skin: 'gray'
});
});
});
I thought the cache: false would force a new ajax call.
Should I be doing this a different way?

Scott

Comments

  • edited February 20

    Seems like you're calling Tipped.create twice on the same element, that creates two tooltips. Call Tipped.remove before you create the second tooltip to have just one.

    If you use cache: false the tooltip will do the ajax request every time it opens, but your data seems to be dynamic so that won't work. You'll have to recreate the tooltip if you need to pass in different parameters for the ajax request.

Sign In or Register to comment.