jQuery发送JSON

I need to send json data via POST, so in my var request has the structure of the json object

Anytime a button is clicked, I call this function:

function sendJSON(p_id, p_type) {
        var request=[{
          "id":null,
          "version":null,
          "type":null,
          "enabled":false,
          "priority":null,
          "params":[
            {
              "id":null,
              "version":null,
              "value":p_id,
            },
            {
              "id":null,
              "version":null,
              "value":p_type,
              "valueXML":null,
              "editable":false,
            }
          ],
          "lastEX":null
        }
        ];
        console.log(request);
        $.ajax({
            url: 'http://192.168.4.6:8080/recList/',
            type: 'POST',
            crossDomain: true,
            contentType: 'application/json',
            data: request ,
            dataType: 'json',
            success: function (response) {
                var resp = JSON.parse(response);
                alert(resp);
            },
            error: function (xhr, status) {
                alert("err");
            }
        });
    };

I can't figure it out why it doesn't work Did I forget something?

Request URL:http://192.168.4.6:8080/recList/
Request Method:OPTIONS
Status Code:200 OK

Accept:*/*
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US;q=0.6,en;q=0.4
Access-Control-Request-Headers:content-type
Access-Control-Request-Method:POST
Connection:keep-alive

change type: 'POST' to method: 'POST',

Your Json variable is

request=[{..}];

Please try to remove outer square brackets i.e '[' and ']'.

Then your request variable is:

var request={
      "id":null,
      "version":null,
      "type":null,
      "enabled":false,
      "priority":null,
      "params":[
        {
          "id":null,
          "version":null,
          "value":p_id,
        },
        {
          "id":null,
          "version":null,
          "value":p_type,
          "valueXML":null,
          "editable":false,
        }
      ],
      "lastEX":null
    };

pass your request variable in the data as shown below

data : {'data':request}

and access the data in your function using 'data' key.