Out of curiosity since eval is "evil". Would serializing an array protect against xxs attacks? From my understanding the serializeArray() method creates a JavaScript array of objects, ready to be encoded as a JSON string. If so, what would be a better way to evaluate the data.
var formdata = $('#form').serializeArray();
$.post('https://www.example.com', formdata, function(data) {
if(data) {
var buffer = eval('(' + data + ')');
// do some logic to check for errors
} else {
// sumbit the form
}
});