javascript - Remove prefix from string with .split results in Unexpected token ILLEGAL -


i have string strange prefix , i've tried using split function return array after slash character "\". string: i:0#.w|itun\allepage_fg

this tried:

function claimorder(){     var user = $().spservices.spgetcurrentuser({     fieldname: "name",     debug: false     });      var trimuser = user.split("\");      $().spservices.spfindpeoplepicker({     peoplepickerdisplayname: "napa user",     valuetoset: trimuser[1],     checknames: true     }); } 

i error: unexpected token illegal

you need escape backslash inside string literal:

var trimuser = user.split("\\"); 

in future, when error that, tell relevant line. case obvious, won't be.


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo