Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I am get the C# List value from javascript

result =[",mistke",",multple"]

so i want to split this as list of values

like result this=> var temp=tempresult[2];

//this is i want result
//tempresult[0]="mistke";tempresult[1]="multple";

how to do this?


Thanks in advance............
Posted

Try removing the special char from the value first.
JavaScript
var outString = result.replace(/[`~!@#$%^&*()_|+\-=?;:'".<>\{\}\[\]\\\/]/gi, '');
var newArrayOfValues = outString.split(',');//Now you have an array of your values.



--Amit
 
Share this answer
 
Try result.split(',');

I hope this should work
 
Share this answer
 
Comments
U@007 22-Feb-13 6:38am    
var split = result.split('[');
already I tried man how to pass multiple symbals in split method

like this // result.split('[',']',',');

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900