jeudi 28 juillet 2016

how to add content-type with $.post method in ajax call

Hi i want to add contentType:"application/json" to $.post method I don't want to use $.ajax as

$.ajax({
  url:url,
  type:"POST",
  data:data,
  contentType:"application/json",
  dataType:"json",
  success: function(){
    //success code
}

but I want to use $.post method

$.post(url,data,function(result){
    //success code
});

Please any one help me to specify contentType with $.post method

Aucun commentaire:

Enregistrer un commentaire