Mark Wong
Posts: 0
Joined: Sat Feb 14, 2015 7:47 am

I'm not sure about what is the correct form of this JS code

I'm not sure about what is the correct form of this JS code
codelocalStorage.setItem('ProfileRequest', "{'username':'+user_name+'}");/code
I need the ProfileRequest to map the request of where,
therefore the format should be something like {"username":'1'} but I want the user_name local storage variable replace '1'
What should be look like of the correct form of this JS code?
Thank you

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

I'm not sure about what is the correct form of this JS code

Hello Mark,

Please try this code
prelocalStorage.setItem('ProfileRequest', "{'username':'"+user_name+"'}");/pre
instead of yours

Mark Wong
Posts: 0
Joined: Sat Feb 14, 2015 7:47 am

I'm not sure about what is the correct form of this JS code

I've used the code that you've told me
when the page load, call JS codelocalStorage.setItem('ProfileRequest', "{'username':'"+user_name+"'}");/code
When I click the button to navigate to the target page which contain this JS code, its not able to navigate.
Moreover, when I try to click any button with function, it's not working too.
(Only after I clicked that button to navigate to the target page.)

Mark Wong
Posts: 0
Joined: Sat Feb 14, 2015 7:47 am

I'm not sure about what is the correct form of this JS code

I've already used another way to replace this "problem" by putting this JS code in the mapping
code
return '{"username":{"$regex":"^'+value+'", "$options":"i"}}';
/code
and map to the user_name
anyway thank you! Answered :)

Return to “Issues”