'Not able to understand how tag value is included from jsp page to js file
I am facing a problem where I have button in jsp page if i click it then it opens the dialogue and for the first time I am opening it , it shows the title of the dialogue box but from the second time onwards it doesnt show the title of dialogue.. I just started working on javascript and jsp , here I need a little help to understand where this value is coming from ,
**if($('#add-meeting-time').size() == 0)
$('body').append('<div id="add-meeting-time" />');**
How #add-meeting-time tag value is coming from jsp and why it is fetching the tag value add-meeting-time from jsp first time and not from the second time. I have added the code below. please have a look and help thanks in advance.
function addMeetingTime(caseId, passedds) {
showOverlay();
$.ajax({
url : 'case/RepairPro_addInputAgreeMeetingEvent?passedds='+passedds,
type : 'get',
data : 'cid=' + caseId + "&t=" + Math.random(),
success : function(data) {
if($('#add-meeting-time').size() == 0)
$('body').append('<div id="add-meeting-time" />');
$('#add-meeting-time').html(data);
$( "#add-meeting-time" ).dialog({
autoOpen: false,
modal: true,
width:650,
buttons: {
action: {
text: getText('save'),
click: function() {
disableDialogButton();
$('#add-meeting-time form').submit();
}
},
cancel: {
text: getText('cancel'),
click: function() {
$( this ).dialog( "close" );
}
}
},
create: function() {
var datepickerSettings = {minDate: 0};
if (getConfig('isDisplayTimezone')) {
datepickerSettings = {}
}
if(getConfig('isCalendarModularEnabled')) {
if(localMember.myrole > parseInt(getGlobal('AUTH2'))) {
$(this).parent().find('.ui-dialog-title').before($("<a href='javascript:void(0);' onclick='addMeetingTimeCalendar(\"" + passedds + "\", " + caseId + ");' title=\"" + getText('calendar_view') + "\" style='float:left; margin-right:1em;' class='ui-icon extra-dialog-button'></a>")
.button({icons:{primary: "ui-icon-calendar"},text: false}));
}
else {
$(this).parent().find('.ui-dialog-title').before($("<a href='javascript:void(0);' onclick='addPersonalMeetingTimeCalendar(\"" + passedds + "\", " + caseId + ");' title=\"" + getText('calendar_view') + "\" style='float:left; margin-right:1em;' class='ui-icon extra-dialog-button'></a>")
.button({icons:{primary: "ui-icon-calendar"},text: false}));
}
}
$(this).find('.datepicker').datetimepicker(datepickerSettings);
showTaskError(this, 'refreshCaseMessagesPage()');
initTeamMemberSelect();
},
open: function() {
$('select[id=add-meeting-member] option:eq(1)').attr('selected', 'selected');
$('select[id=add-meeting-member] option:eq(0)').attr('selected', 'selected');
},
close: function() {
$( this ).dialog( "destroy" ).remove();
}
});
$( '#add-meeting-time' ).dialog( 'open' );
}
});
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
