[Answered ]-Django jQuery get sending logged in users data

1👍

Seems to me that you need to specify a parameter name in your data map. So, instead of:

$.get(this.href, { request.user: request.user }, function(data){

You would have:

$.get(this.href, { parameter_name : request.user }, function(data){

Where parameter_name is the name of the get variable the page you are requesting expects to receive.

Take a look at the jQuery docs, about midway down the page:

http://api.jquery.com/jQuery.get/

1👍

There is a problem with the syntax used to pick up the variables. You’ll need two curly brackets to pick up the variable in the template. Something like this: {{ request.user }}.

However I am not sure that you can include it directly as there is an obvious clash with the JS syntax. You might want to collect {{ request.user }} into a variable and then use it in the dictionary.

Leave a comment