I know that there are four request types such as get ,put ,post ,delete .When and why will I use type='put' or type="post" ?Basically what are the differences between them?
$.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>'); } });