0

I have following bootstrap datepicker:

enter image description here

Now, when I am deleting the 24th date from my another table, as a result, it should remove the 24th date from the date picker after the ajax call.

I have written the following code for it. However, it's not working:

$.ajax({
            type: "POST",
            url: "<?php echo VIEW_HOST_PATH;?>remove_data.php",
            data: {ch: ch, dh: dh, sp_rec: sp_rec, cartDate: 1},
            success: function(data) {
                console.log(data);

                var obj = $.parseJSON(data);
                //console.log(obj.length);
                var selectedDates = '';
                for(var i=0;i<obj.length;i++) {
                    //selectedDates = selectedDates+"'"+obj[i]+"',";
                    //$('#disc_single_datepicker_1').datepicker('setDates',[obj[i]]);
                }
                console.log(selectedDates);
                //alert(selectedDates); 
                //$('#disc_single_datepicker_1').datepicker('setDates',[data]);
                //$('#disc_single_datepicker_1').datepicker('update',selectedDates);
                display_toastr(datainfo+" record has been removed!","Remove Record",true,"right","info");
                $("#row_"+dh).fadeOut('slow');

            }, error: function() {
                alert("Something went wrong. Please contact admin!");
            }
        });

so what should I write to unset that particular date. thanks

Jimil
  • 650
  • 2
  • 14
  • 37
  • https://stackoverflow.com/a/46315417/10634638 – estinamir Apr 20 '20 at 04:10
  • @bestinamir thanks but its still not working for my particular case as what I am trying to do is to unset the 24th date. Now,how I can convert and setUTCDate for 24/04/2020? – Jimil Apr 20 '20 at 04:19
  • Try hardcoding this date to see if it works at all. – estinamir Apr 20 '20 at 04:27
  • If you asking how to clear, one way is to clear everything then set what. – estinamir Apr 20 '20 at 04:38
  • not working as getting error TypeError: a.getTime is not a function bootstrap-datepicker.min.js:7:9197 – Jimil Apr 20 '20 at 04:39
  • yeah, I think that's also fine to unset and then set again but I don't find any solution on that either. – Jimil Apr 20 '20 at 04:40
  • Here they follow different format to set https://stackoverflow.com/q/25874375/10634638 – estinamir Apr 20 '20 at 04:42
  • Since the dates are toggle on/off may be you can fire a click event for specific date https://stackoverflow.com/a/57383235/10634638 – estinamir Apr 20 '20 at 05:29
  • @bestinamir the following solution didn't work for me as I've tried: https://stackoverflow.com/questions/25874375/multiple-dates-in-bootstrap-date-picker – Jimil Apr 20 '20 at 05:49
  • @bestinamir the following is also in no use:https://stackoverflow.com/questions/45175100/bootstrap-datepicker-trigger-change/57383235#57383235 – Jimil Apr 20 '20 at 05:50

0 Answers0