Ajax PUT json body missing

Ajax PUT json body missing

Using the following ajax request the server does not get any json body content in the request.
I have testing the server with cURL and POSTMan chrom plugin and all is working.

  1. var xhr = $.ajax({
        type: "PUT",
        url: url,
        contentType: 'application/json',
        data:'{"key": "val"}',
        dataType: 'json',
        timeout: 12000, // 12 seconds because server is so slow
        headers: {
            Accept: "application/json"
        }
    }).done(function( response, status, jqXHR ) {
        console.log('Update successful', response);

    }).fail(function( response ) {
        console.log('Update failed: ', response);
    });














I then check for any parameters in the php server side code as follows:
  1. $request = $_REQUEST;
    $input = file_get_conents("php://input");
    file_put_contents('/tmp/tmp.log', var_export($request, true));
    file_put_contents('/tmp/tmp.log', var_export($input, true));


Any help would be hugely appreciated!