ajax ajaxSetup() method


  Translation results:

Ajax

English [ˈeɪˌdʒæks] American [ˈeˌdʒæks]

n. The full name is "Asynchronous JavaScript and XML" (asynchronous JavaScript and XML); refers to a A web development technology for creating interactive web applications. ;Ajax copper-tin-lead bearing alloy, Yajis explosive

setup

UK['setʌp] US[ˈsɛtˌʌp]

n. Plan;<口>Organize;Posture;<口>Deliberately arrange the game to make it easier for one side to win

ajax ajaxSetup() methodsyntax

Function: jQuery.ajaxSetup() method sets global AJAX default options.

Syntax: jQuery.ajaxSetup(name:value, name:value, ...)

Parameters:

ParameterDescription
name:value Optional. Use name/value pairs to specify settings for AJAX requests.

ajax ajaxSetup() methodexample

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
    $.ajaxSetup({url:"http://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg",error:function(result){
     alert("请求失败");}});
    $.ajax();
  });
});
</script>
</head>

<body>

<div id="txt"><h2>通过 AJAX 改变文本</h2></div>
<button>改变内容</button>

</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A