我知道有四种请求类型,例如 get ,put ,post ,delete 。我什么时候以及为什么要使用 type='put' 或 type="post" ?它们之间基本上有什么区别?
$.ajax({
url: '<?php echo site_url('rest_api / contacts ')."?format=json"; ?>',
type: "put",
data: $('#subpanel-contacts-add-form').serialize(),
success: function (response) {
//some tasks
}
error: function () {
$("#subpanel-contacts-form-result").html('<div class="alert alert-error">Error: There was an error while submitting!</div>');
}
});