tags:

views:

107

answers:

2

I have a javascript function which would populate a list of related item in a div when the user types a letter in the ipyt box.I m calling a aspx (C# -codebehind page) page in my ajax call and that aspx page would return the output as a string delimitted by | (pipe symbol) .But my code is breaking if the item of string contains a | symbol in itself. for Normal condition, My items are Item1, Item2,Item 3 ajax server page will output this as Item1|Item2|Item3 and iside my javascript i am spliting this string with | and getting each value. If the Item contains a pipe symbol Ex : Ite|m1 The script of splitting is braking.Can anyone tell me how to solve this.Is there any character which is not present in keyboeard , which i cam make use of for the delimiter

Thanks in advance

+2  A: 

I think you should try using JSON ( homepage / wikipedia ) instead of concatening / splitting.

andi
A: 

In the past I've used ~ and | 's and then ignored those keypress events but I agree with andi - json is a better approach

BPAndrew