jquery plugin click event

jquery plugin click event

I have written successfully a few jQuery plugins. However this plugin is the one I am having difficulty with.
Now the plugin works and does what it is supposed to, but only the first time it is run.

I would like to run it again with updated data, but it won't work if I run it twice.
eg if I run this like this
  1. $('#phonedate_admin').dateRange({ url: 'database/phonelog/tables/phone_table.php',sender:{PAGE:vPage(),USER_ID:"",SEARCH: "harley"}});
  2. $('#phonedate_admin').dateRange({ url: 'database/phonelog/tables/phone_table.php',sender:{PAGE:vPage(),USER_ID:"",SEARCH: "angel"}});

SEARCH will always have harley in it, and not angel. Running it twice does not seem to over write the variables. Really if I run it twice like this Harley should never show.
I have also some key click events. I am using $(document).on('click' as they have to be dynamic. Basically Sender is an object which I use to post my variables to php.

I have been writing jQuery for a while, but I am new at plugins.

I wonder if anyone can see where I am going wrong. I will paste my plugin here.
  1. ;(function($) {
  2.     "use strict";
  3.     $.fn.dateRange = function(options) {
  4.         var settings =$.extend(true, {},{
  5.             'url':null,
  6.             'myid':null,
  7.             'sender':{}
  8.         },options);
  9.         var base=this;
  10.        
  11.         var dateName = $.trim(this.attr('id'));
  12.        
  13.         dateName="#"+dateName;
  14.         var dp_start= dateName+"_start";
  15.         var dp_end= dateName+"_end";
  16.         var startDate=dateName+"_startDate";
  17.         var endDate=dateName+"_endDate";
  18.         var url=settings['url'];
  19.    
  20.         base.init= function() {   
  21.             base.clicker();
  22.             base.range_datepicker();
  23.         };
  24.        
  25.         base.update_search= function(sendin){
  26.             settings.sender = $.extend(settings.sender,sendin);
  27.         };
  28.        
  29.         base.clicker= function() {
  30.             $(document).on('click',dp_start, function()
  31.             {   
  32.                 $(startDate).datepicker('show');
  33.             });
  34.             $(document).on('click',dp_end, function()
  35.             {
  36.                 $(endDate).datepicker('show');
  37.             });   
  38.         };
  39.        
  40.         base.check_height= function(){
  41.             if($(dp_start).height()>=$(dp_end).height()) $(dp_end).height($(dp_end).height($(dp_start).height()));
  42.             if($(dp_end).height()>=$(dp_start).height()) $(dp_start).height($(dp_start).height($(dp_end).height()));
  43.         }
  44.        
  45.         base.range_datepicker= function() {
  46.             $(startDate).datepicker({
  47.                 showAnim: 'slideDown',
  48.                 numberOfMonths:3,
  49.                 changeMonth: true,
  50.                 changeYear: true,
  51.                 dateFormat: 'dd/mm/yy',
  52.                 onClose: function (selectedDate){
  53.                     $(endDate).datepicker("option","minDate",selectedDate);
  54.                     base.filterDate();
  55.                 }
  56.             });
  57.             $(endDate).datepicker({
  58.                 showAnim: 'slideDown',
  59.                 numberOfMonths:3,
  60.                 changeMonth: true,
  61.                 changeYear: true,
  62.                 dateFormat: 'dd/mm/yy',
  63.                 onClose: function (selectedDate){
  64.                     $(startDate).datepicker("option","maxDate",selectedDate);
  65.                     base.filterDate();
  66.                 }
  67.             });
  68.         };
  69.        
  70.         base.filterDate= function() {
  71.             base.insert_squaredate(startDate,"Start");
  72.             base.insert_squaredate(endDate,"End");
  73.             var send = {STARTDATE: $(startDate).val(),ENDDATE: $(endDate).val(),};
  74.             send = $.extend(send,settings.sender);
  75.            
  76.             alert(send.toSource());
  77.            
  78.             $("#table_form").load(url, send, function() {
  79.                 table_resize('table.scroll');
  80.             });
  81.         };
  82.        
  83.         base.insert_squaredate= function(mydiv,text){
  84.             var date = $(mydiv).datepicker('getDate');
  85.             if(date===null)
  86.             {
  87.                 $(mydiv+"1").text(text);
  88.                 $(mydiv+"2").html('<span class="calendar_datepicker"></span>');
  89.                 $(mydiv+"3").text("");
  90.             }
  91.             else
  92.             {
  93.                 var month=$.datepicker.formatDate('M',date);
  94.                 var mydate=$.datepicker.formatDate('d',date);
  95.                 var year=$.datepicker.formatDate('yy',date);
  96.                 $(mydiv+"1").text(month);
  97.                 $(mydiv+"2").text(mydate);
  98.                 $(mydiv+"3").text(year);               
  99.             }   
  100.             base.check_height();
  101.         };
  102.         base.reset_date= function(){
  103.             base.reset(startDate,"Start");
  104.             base.reset(endDate,"End");
  105.         }
  106.         base.reset= function(mydiv,text){
  107.             $(mydiv).val('');
  108.             $(mydiv+"1").text(text);
  109.             $(mydiv+"2").html('<span class="calendar_datepicker"></span>');
  110.             $(mydiv+"3").text("");
  111.         }
  112.    
  113.         base.init();
  114.         return base;
  115.     }
  116. })(jQuery);