Diff between $.ajaxSetup and $.ajax in jquery
Posted
by
Deeptechtons
on Stack Overflow
See other posts from Stack Overflow
or by Deeptechtons
Published on 2012-04-10T17:25:39Z
Indexed on
2012/04/10
17:29 UTC
Read the original article
Hit count: 472
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 ?
© Stack Overflow or respective owner