How to send a JSON object with jQuery

Here is an example on how you can send a JSON object to a server with jQuery:

<script src=""></script>
<script type="text/javascript">
  var data = {
    "name": "Neugebauer",
    "prename": "Benny",
    "age": 24,	
    "likes": [],        
    "device": "Laptop"
      type: "POST",
      url: "",
      data: typeof data == "string" ? data : JSON.stringify(data || {}),
      dataType: "json",
      contentType: "application/json; charset=utf-8",
      success: function(data, textStatus, jqXHR){
        console.log('OK:' + data);
      error: function(data, textStatus, jqXHR){ 
        console.log('ERROR:' + data);