[Fixed]-Django – passing parameters to GET method when using JS window.open() function

1👍

Since you’re just opening a page, using POST is not an easy option (you could by having it automatically submit a form from /my_url/, but I wouldn’t recommend it). You could easily append some GET parameters to /my_url/ though. Something like: `/my_url/?json=…your-json-data…

Within Django you can reach this using request.GET['json']

Example with your code:

function draw_comparing_graphs()
{
    window.open('/my_url/?json=' + encodeURIComponent(json_data), '_blank', 'location=yes,height=570,width=1500,scrollbars=yes,status=yes');  
}
👤Wolph

Leave a comment