Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ

i want to get current url from javascript and i keep current url in session on controller and call the session in my model but i got nothing and no error:

controller.py:

@http.route(['/action_set_current_url/<string:url>'], type='json', auth="public")
def set_current_url(self, url, **post):
request.session['my_current_url'] = url
return {"my_current_url":my_current_url}

mymodel.py to get session:

current_url = http.request.session.get('my_current_url')

javascript code:

$(window).on('hashchange', function(e){
var url=window.location.href
    openerp.jsonRpc("/action_set_current_url/", 'call',url)
});
Ảnh đại diện
Huỷ bỏ

in the js, console the url and check whether there is value inside it

Tác giả

how to check the value inside when i'm working in remote server??

you can check the in console of the browser

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 6 15
10602
0
thg 11 23
1915
1
thg 12 20
4964
3
thg 7 19
15265
0
thg 3 18
365