how do I read localstorage data stored in database

22 views
Skip to first unread message

Maurice Waka

unread,
Jun 7, 2020, 6:46:50 PM6/7/20
to web2py-users
with this code:

js(view)

$('#timed').change(function(){  
        arr
.push($(this).val());
       
var arrayJSON = JSON.stringify(arr);
        localStorage
.setItem("tabledata",arrayJSON);

controller
value =request.vars.json
if valued:
    db
.post.insert(message=value)



My data is stored as 

<Storage {'json': '{"list":"[\\"sure\\",\\"<39\\",\\"unconfirmed_pcr\\"]"}'}>



how can I read a clean list like:

["sure","<39","unconfirmed_pcr"] or ["sure,<39,unconfirmed_pcr"]

Currently i'm using n.replace(). Is there a better, faster way?

Kind regards
Reply all
Reply to author
Forward
0 new messages