Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
6710 มุมมอง

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)
});
อวตาร
ละทิ้ง

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

ผู้เขียน

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

you can check the in console of the browser

ผู้เขียน
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
มิ.ย. 15
10482
0
พ.ย. 23
1795
1
ธ.ค. 20
4853
3
ก.ค. 19
15134
0
มี.ค. 18
365