javascript - Using '&' in ajax form submit -


i submitting form using .ajax().

the current script contains:

data: datastring, 

datastring contains:

var list    = $('.listsummary').val() 

the class listsummary belongs textarea users fill in, or (partially) filled in dynamically through different script.

the problem users of time use '&' sign, example:

potato & patota blah blah blah 

this screws datastring allowing post written before first '&' found.

how can achieve var list sent php handler in order store entire textarea content database use of '&'?

you can encode string encodeuricomponent()

var list = $('.listsummary').val(); var urlencoded = encodeuricomponent(list); 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -