How to change $.ajax() default settings?

后端 未结 2 2008
悲哀的现实
悲哀的现实 2020-12-31 10:13

How can I modify the default values of options for the $.ajax() function?

Ideally to do something similar to:

//set ajax async to false
$(someSelec         


        
2条回答
  •  無奈伤痛
    2020-12-31 10:22

    You want ajaxSetup

     $.ajaxSetup({
       url: "/xmlhttp/",
       global: false,
       type: "POST"
    
     });
     $.ajax({ data: myData });
    

提交回复
热议问题