擅长:python、mysql、java
<p>要发布JSON</em>,请不要使用<code>$.post()</code>。请改用<code>$.ajax()</code>,并显式设置内容类型:</p>
<pre><code>$.ajax({
url: URL,
type: "POST",
data: JSON.stringify({phone: tableData.getData()}),
contentType: 'application/json; charset=utf-8'
dataType: 'json',
success: function(data) {
console.log(response);
},
});
</code></pre>
<p>如果您有一个直接处理JSON的控制器,例如<a href="http://pythonhosted.org/TGWebServices/" rel="nofollow">TurboGears Web Services</a>提供的控制器,这一点尤其有用。在</p>