skip to Main Content

I’m coming back with a very simple questions, yet I am not able to solve it on my own…

I found a powerful Daterangepicker in Javascript : http://www.daterangepicker.com/#ex5 . As I have never learned js, I would like to know how to pass the start and end dates out of the widget to the views.py file… The few hints I got came from this topic : Django and date range picker component for Twitter Bootstrap which only provides the code for Django and not the js.

Many thanks !

2

Answers


  1. Chosen as BEST ANSWER

    Ok, I found the solution ! Maybe it will be useful for someone else, so I paste it here :

    $.ajax({
       url:'/',
       type : "POST", 
       data: {start : 'start', end : 'end'},
       success: function(response){},
       complete: function(){},
       error: function(xhr, textStatus, thrownError){}
       });
    

  2. You can find the function in http://www.daterangepicker.com/#ex5

    function(start, end, label) {}
    

    Use AJAX requests to send this data to server(view).Something like

    function(start, end, label) {
        $.post("url",
        {
           "start":start,
           "end": end
        },
        function(data, status){
            alert("Data sent);
        });
    
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search