1

I want to sent array through URL in ajax and at back end I want to access that array in python . How can I do that

<!--Java script code -->
var arr[] = [1,2,3];
$.ajax(function(){
 url: 'myurl/arr=' + arr,
});

How to use that 'arr' in python for displaying

--edit--

def use_arr(request)
  method = request.GET
  list = method.get('arr')

The above is python view where I am suppose to use that array but I am not able to access to that array for display purpose.

xxCodexx
  • 438
  • 1
  • 3
  • 15

1 Answers1

0

Javascript

$.get('myurl', {arr: JSON.stringify(arr)})

Read more about $.get: https://api.jquery.com/jquery.get/

Python

import json
# ...
list = json.loads(request.GET['arr'])