擅长:python、mysql、java
<p>由于发布的是<code>JSON</code>-数据,因此必须声明数据类型“JSON”:</p>
<pre><code>$.ajax({
url: '/post',
type: 'POST',
dataType: "json",
data: {"post-form": postcontent},
success: function(response, textStatus, jqXHR) {
alert("Yay!");
},
error: function(jqXHR, textStatus, errorThrown){
alert(textStatus, errorThrown);
}
</code></pre>