Divider for string value for Ajax response

I have a javascript function that will populate a list of related item in a div when the user enters an email in the ipyt field. I am invoking an aspx page (C # run page) in my ajax call and this aspx page will return the result as a string limited to | (pipe symbol). But my code breaks if the line element contains | symbol in itself. for normal condition, My items - Item1, Item2, Item 3 ajax server page will display this as Item1 | Item2 | Item3 and iside my javascript. I share this line with | and get every value. If the element contains a pipe symbol Example: Ite | m1 Separation script is braking. Someone will tell me how to solve this. Is there any character that is not in keyboeard that I use for the delimiter

Thank you in advance

+3
source share
2 answers

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

+2
source

In the past, I used ~ and | and then ignored these keystroke events, but I agree that andi-json is the best approach

0
source

Source: https://habr.com/ru/post/1704956/


All Articles