Ajax Forms and how to save or print + and other special symbols successfully
Sending special characters such as plus symbols through an AJAX form to be received the other end requires a bit of trickery. Often when programmers experience trouble with this kind of transmissions there was either
successfully without turning it into an encoded format which can be passed along without causing any problems:
var poststr = "get1=" + encodeURIComponent( document.getElementById("id1").value );
Note that encodeURIComponent() is the key in the above code. This little bit of formatting has solved half our problem. However, we still need a function to effectively decode the variable on the server side end of things. In PHP, most tutorials will tell you to decode the variable using urldecode():
$string = urldecode($_POST['variable']);
$string = rawurldecode($_POST['variable']);
With rawurldecode() your plus symbols and (most) other special symbols should be translated successfully.