I am trying to send simple data to sservre and I need a "rough and ready" way to do this.
This is what I have so far:
var emails = ['a@123.com', 'b@123.com', 'c@123.com'];
var ruff_json = "{ 'emails': [";
for (i in emails)
ruff_json += ((i == 0) ? '' : ', ') + '\''+emails[i]+'\'';
ruff_json += '] }';
jQuery.ajax({
type: 'POST',
url: '1.php',
data: ruff_json,
dataType: "json",
timeout: 2000,
success: function(result){
},
error: function (xhr, ajaxOptions, thrownError){
}
});
Using Firebug, I see that the data is being sent to the server, but there is no data on the server ($ _POST is empty) - what am I doing wrong?
source
share