Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delimitter for string value for Ajax response

Tags:

ajax

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

like image 528
Shyju Avatar asked Dec 21 '25 13:12

Shyju


1 Answers

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

like image 54
andi Avatar answered Dec 23 '25 02:12

andi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!