I think the + character is being interpreted as a space in the URL. Try using encodeURI() on the variable like: data: "book="+encodeURI(list)
http://xkr.us/articles/javascript/encode-compare/ On Feb 11, 6:17 am, rocky <guess.19812...@gmail.com> wrote: > i m posting some data on url page but it displays incomplete.following > is the code snippet,what thing i m doing wrong plz notify me so that i > correct,thanks > > test.js > > var list="vc++"; > > $.ajax({ > type: "POST", > url: "test.php", > dataType: "json", > data: "book="+list, > timeout: 5000, > success: successA, > error: errorA > > }); > > function successA(data){ > //code > > } > > function errorA(data){ > //code > > } > > test.php > > echo $_POST['book']; > //it displays only vc not vc++ (using POST method)