What is jQuery.ajaxSetup() method in jQuery?

jQueryWeb DevelopmentFront End Technology

The jQuery.ajaxSetup() method sets global settings for future AJAX requests. Here is the description of all the parameters used by this method-

Let’s say we have the following HTML content in result.html file,

<h1>THIS IS RESULT...</h1>

The following is an example showing the usage of this method. Here we make use of success handler to populate returned HTML:


      <title>The jQuery Example</title>
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
         $(document).ready(function() {
               // Do global setting.
                  url: "result.html"
               $.ajax( {
                  success:function(data) {
      <p>Click on the button to load result.html file:</p>
      <div id = "stage" style = "background-color:#cc0;">
      <input type = "button" id = "driver" value = "Load Data" />

Live Demo

Published on 21-Dec-2017 07:18:28