世界上并没有完美的程序,但是我们并不因此而沮丧,因为写程序就是一个不断追求完美的过程。
<script>
var data = {};
data.name1 = '1';
data.name2 = '2';
$.ajax({
url : 'http://localhost:8080/test',
type : 'POST',
dataType : 'json',
contentType : 'application/json;charset=UTF-8',
data : JSON.stringify(data),
success : function (re) {
console.log(re);
}
});
</script>
复制代码