Ajax网址参数

I'm a newbie to Ajax and trying to understand how Ajax works from the below tutorial that was given in w3schools.

In the below code, the 'url' is set to demo_ajax_load.txt. Will demo_ajax_load.txt will be a plain text file in the server that is passed once the call is made?

Generally I see, a php or asp code that will be called which will pass a html or text object..but kind of surprising how a text file will be returned directly...Apologize its a basic elementary question.

Also, how the result from the url is directly passed into the function - function(result)?

<!DOCTYPE html>
<html>
    <head>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
        </script>
        <script>
            $(document).ready(function(){
                $("button").click(function(){
                    $.ajaxSetup({
                        url:"demo_ajax_load.txt",
                        success:function(result){
                            $("div").html(result);
                        }
                    });
                    $.ajax();
                });
            });
        </script>
    </head>
    <body>
        <div><h2>Let AJAX change this text</h2></div>
        <button>Change Content</button>
    </body>
</html>

An AJAX request is essentially an HTTP request to the server that occurs asynchronously (while the user is interacting with the page). The resource being accessed on the server doesn't necessarily need to be php script, or html. In this example, the resource being requested looks to be a simple text file.

When you invoke $.ajax(), jQuery will use the default values you defined in the $.ajaxSetup(...) call. This means it will make a GET request to demo_ajax_load.txt. This request will happen asynchronously, which is why you need to define a success callback function. This function is invoked by jQuery once the server returns a response. The contents of the response (in this case the contents of the file) are then passed as the first argument to that callback function (the result parameter).