实例 jQuery 使用指定的数据类型发出 AJAX 请求

x
 
<!DOCTYPE html>
<html>
<head>
<script src="https://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $.ajax({url: "demo_ajax_script.js", dataType: "script"});
  });
});
</script>
</head>
<body>
<button>Use Ajax to get and then run a JavaScript</button>
</body>
</html>
                    

输出结果