How can I use spaces in a form input's user entered value with jQuery .serializeArray and PHP? -


i have form element , use (abbreviated),

var dataarray = $(this).serializearray(),     dataobj = {};  $(dataarray).each(function(i, field){   dataobj[field.name] = field.value; }); 

i use data ajax, sending php page (abbreviated).

url: '/api/controller/name/' + dataobj['guys-name'] 

if enter (minus quotes),

the lazy brown fox

it submitting this, understand because has spaces %20,

the%20lazy%20brown%20fox 

but when use print_r() this,

array (     [0] => thelazybrownfox ) 

i need can enter name in 1 line smith john. can make 2 form inputs, not want do.

url strings browser transform using punycode. right way correct way use or post parameters.

$.post( "/api/controller/name/", { name: dataobj['guys-name'] } ); 

or decode string "the%20lazy%20brown%20fox" punycode.


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -