Reputation: 3564
I have some page /page/< some_id >/
.
On this page I have form which are sent to some other url /ajaxreq/
.
Is it possible to read /page/< some_id >/
from request object in /ajaxreq/
view?
PS: I know, this is a design issue and there are many other ways to solve it, but it is interesting is such approach possible or not? It will be very useful and graceful in some cases.
Upvotes: 0
Views: 33
Reputation: 1619
You could use request.META.get('HTTP_REFERER')
in the view and extract the info from there.
Upvotes: 1
Reputation: 3475
You can do that with JS It should be something like this:
var link = [];
var url = window.location.pathname;
link = url.split('/');
var some_id = link[link.length-1];
Upvotes: 0