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 Answer 1

2
  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.
Sign up to request clarification or add additional context in comments.

2 Comments

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: you are correct. I saw the inline <script> tags and figured that the JS might be included in the template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.