Ticket #8798 (closed bug: duplicate)
jQuery appends some weird string on the data sending to server
| Reported by: | neodeep2001@… | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.next |
| Component: | data | Version: | 1.5.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
StackOverflow discussion: http://stackoverflow.com/questions/5578754/jquery-append-some-weird-string-into-the-data-submitted
Code to reproduce the bug (Put the following code in the html page and read the data submitted in Fiddler. jQuery 1.4.2 works fine, the problem happens in 1.5.1 and 1.5.2).
<html> <head> <script src=" https://github.com/douglascrockford/JSON-js/raw/master/json2.js"></script> <script src=" https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> <script> var data = { "Name": "test??", "testDesc": "testdesc??"};
$.ajax({
url: "submit.aspx/SubmitData", data: JSON.stringify(data), type: "POST", contentType: "application/json; charset=utf-8", dataType: "json", cache: false
}).success(function (msg) {});
</script> </head> <body></body> </html>
With the above code, the data sending to the server is { "Name": "testjQuery15103933552800185728_1302170988810", "testDesc": "testdesc??"}
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

The jsFiddle link: http://jsfiddle.net/uTq4n/