Consecutive question marks interpreted as JSONP callback

This reproduces jQuery bug #8417: http://bugs.jquery.com/ticket/8417 jQuery 1.5 will interpret consecutive question marks in string data of an JSON request as a placeholder for a JSONP callback - even if the request is a POST and the data is serialized JSON.

by hallettj

HTML

<script src="https://github.com/douglascrockford/JSON-js/raw/8e0b15cb492f63067a88ad786e4d5fc0fa89a241/json2.js"></script>
<div id="output">
    <p>working...</p>
</div>

JavaScript

$.ajax({
    url: '/messages',
    type: 'POST',
    dataType: 'json',
    data: JSON.stringify({
        message: 'how is it going??',
        author: 'someuser',
        createdAt: (new Date()).getTime()
    }),
    beforeSend: function(jqXHR, options) {
        $('#output')
        .text('Question marks replaced by callback reference:')
        .append(
            $('<code/>').append($('<pre/>').text(options.data))
        );
    }
});