0

I'm only able to return the first date selected and I want to be able to get one string containing it all!

I've done some research that brought me to many similar questions like this one : link but I can't get the answer I'm looking for

This is my code:

HTML

<!-- Date range -->
        <div class="form-group">
            <label>Période:</label>
            <div class="input-group">
                <div class="input-group-addon">
                    <i class="fa fa-calendar"></i>
                </div>
                <input type="text" class="form-control pull-right" id="reservation" onchange=""/>
            </div><!-- /.input group -->
        </div><!-- /.form group -->

JAVASCRIPT

        $(function () {
            //Date range picker
            $('#reservation').daterangepicker({
                onSelect: function (d, i) {
                    if (d !== i.lastVal) {
                        $(this).change();
                    }
                }
            });
        });

        $(document).ready(function () {
            $("#reservation").change(function () {
                var date = $("#reservation").val() + "-" + $("#reservation").daterangepicker("getDate");
                $("#partialtable").load('@(Url.Action("GetDateResults", "Temps", null, Request.Url.Scheme))?date=' + date);
            });
        });

If I select the date range: 06/01/2017 - 06/22/18 , I'm only getting "06/01/2017" in my controller.

UPDATE

"var date" contains the correct value, but it seems to cut the string at the first white space when sending value to controller action.

Thanks!

J. Lavoie
  • 335
  • 2
  • 5
  • 23

1 Answers1

0

This link resolved my problem, solution was to remove the white space because the value contained some.

J. Lavoie
  • 335
  • 2
  • 5
  • 23