How to pass & (ampersand character) in ajax to receive or send a method?

I have a text box to enter a description. If I send, I need to send via ajax and save in db.

Problem: -

Example text in textbox:- "Hi all & solve my problem" in the next page i am getting till "Hi all" Remaining text is missing, If I pass through get or post method using ajax. 

Give me a solution. How to get all the content that I posted in the text box, along with "&"

+4
source share
2 answers

You need urlencode string with escape or encodeURIComponent .

+5
source

Yes, I ran into a problem of the same type and figured out a solution that we need to pass as a pair of key values,

I passed the data to Ajax, for example:

: email = "+ email +" & name = '"+ name

But the right way to transfer data in Ajax is:

data: {email: email, name: name}

0
source

All Articles