Diff between $.ajaxSetup and $.ajax in jquery
- by Deeptechtons
title is a bit misleading but i would like to know internally (what happens during ajax request) when i execute Code 1 and Code 2 in turns
Code 1
$.ajax({url:"1.aspx/HelloWorld",type:"GET",dataType:"json",contentType:"application/json"});
Code 2
$.ajaxSetup({
contentType: "application/json",
dataType: "json"
});
$.get("1.aspx/HelloWorld","",$.noop,"json");
i ask this because the method HelloWorld in page 1.aspx is executed correctly when run Code 1.
But the seconds one refuses to invoke the pageMethod.
I have set the ContentType and data as expected but the second request in Code 2 refuses to invoke the method does anyone have a reason for this ?