Page 1 of 1

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

Posted: Fri Feb 27, 2015 4:27 pm
by Mark Wong

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


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

Posted: Fri Feb 27, 2015 5:32 pm
by Evgene Karachevtsev

Hello Mark,

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


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

Posted: Sat Feb 28, 2015 5:40 am
by Mark Wong

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.)


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

Posted: Sat Feb 28, 2015 4:14 pm
by Mark Wong

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 :)