不使用contentType: 「application/json」則data能夠是對象node
1 $.ajax({ 2 url: actionurl, 3 type: "POST", 4 datType: "JSON", 5 data: { id: nodeId }, 6 async: false, 7 success: function () {} 8 });
使用contentType: 「application/json」則data只能是json字符串ajax
1 $.ajax({ 2 url: actionurl, 3 type: "POST", 4 datType: "JSON", 5 contentType: "application/json" 6 data: "{'id': " + nodeId +"}", 7 async: false, 8 success: function () {} 9 });