jQuery GET status

I already discussed briefly about jQuery GET before. Actually the jQuery GET also return a second parameter indicating the status of getting the file. Let’s see an example:

<head>
<title>jQuery GET Status</title>

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
    $("document").ready(function() {

         $.get('http://localhost/xampp/jquery/urls.txt', function(data, tStatus) {

                    // Check if the result (data) can be passed back
                    alert("The file contents is: " + data + "\n\n" + "The status is: " + tStatus);

            });

    });
</script>

</head>
<body>

<h2>jQuery GET Status</h2>

</body>
</html>

If the URL of the file is correct and everything is going well. The following result will be shown:

jQuery Example File:

Click here to download.

Therefore the visitors will know that the process is going well.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>