Colon in Ajax jQuery data
The code below uses jQuery to gather data from a form and sends it to a PHP script. I have noticed that if one of the variables (variable1,
variable2,
variable3)
contain the ":" (colon) character then this causes problems with the jQuery script and the PHP script won't get the correct input. Is this a known problem? How do I solve this? Are there more characters besides ":" that causes problems?
var variable1 = $('#
variable1
').val();
var variable2 = $('#
variable2
').val();
var variable3 = $('#
variable3
').val();
// post data with ajax
$.ajax({
type: 'POST',
url: 'save.settings.php',
data: {
variable1
:
variable1
,
variable2
:
variable2
,
variable3
:
variable3
},
success: function(data) {
..............
}
}