Spaces been deleted on .ajax POST submit

Spaces been deleted on .ajax POST submit

Can anyone help?
I am submitting my data from a form by using .ajax (in a POST) however all the spaces in the data are lost.

For example if you enter 'John Smith' it comes through as 'JohnSmith'.
I can not use a GET as there is to much information collected in the form (however it does submit correctly with spaces?).

Please see example of code below.

$.ajax({
     type: "POST",
     url: "jquery.asp",
     data: "companyName=" + $('#companyName').val() + "&companyReg=" + $('#companyReg').val() + "&firstname=" + $('#firstName').val() + "&middleName=" + $('#middleName').val() + "&surname=" + $('#surname').val()
});


Many thanks
TFFX
    • Topic Participants

    • tom