views:

27

answers:

1

Can we pass an array to a django url

   <script>
     function save()
     {
       window.location = "/display/xlsdisplay/" + objarr ;   
     }

    var objarr = new Array();

    </script>

Urls.py

         (r'^xlsdisplay/(?P<qid>\d+)$', 'xlsdisplay'),

There is an error saying

             http://192.168.1.11/display/xlsdisplay/334,335,336,337,338,339,340,341,342,343
+1  A: 
  1. The regular expression used in your URL will only match a sequence of digits. The comma will require a different expression.
  2. I don't know your specific need but you ought to look at naming URLs rather than hard cording them.
Manoj Govindan
Re 2. if the JS is not rendered as part of a django template, using a reverse lookup of a named URL won't work, of course.
stevejalim
@stevejalim: you are correct. I saw the inline `<script>` tags and figured that the JS might be included in the template.
Manoj Govindan