encoding - php encoded post param values -


was experimenting basic http post stuff php , ran problem.

1.php:

<head>     <script src="/scripts/jquery.js"></script> </head> <body>      <script>         function hw(){             $.ajax({               type: 'post',               url: '/2.php',               data: 'param=a+b+c',               success: function(d){                 console.log('server said ' + d);               }             });          }     </script>     <button onclick="javascript:hw();">click me</button> </body> 

2.php:

<?php echo $_post['param']; ?> 

the ajax call returns 'a b c' instead of 'a+b+c'. why '+' encoded ' '(space) ?

i tried using content type of post request 'text/plain' instead of default 'application/x-www-form-urlencoded'. in case, $_post['param'] comes out empty ? want understand going on in both these cases. do on server side original data ( '+' ) ?

use data: {param: 'a+b+c'}


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -