articles

Home / DeveloperSection / Articles / jQuery ajaxComplete method

jQuery ajaxComplete method

Sachindra Singh8368 21-Feb-2011

JQuery ajaxSuccess method () will execute when Ajax request has completed. JQuery has full suite capabilities with Ajax. JQuery function give us functionality to read data from server without refreshing the page. In this article I am trying to show you that how we can implement ajaxSuccess () method in page. For example I want to read “Jquery.txt” files from server.  When file has loaded successfully then this method will show message (“Notepad file loaded”).

Code:
<title>JQuery ajaxComplete method</title>
     <scripttype="text/javascript"src="jquery.min.js">
    </script>
 
    <scripttype="text/javascript">
        $(document).ready(function()
        {
            $("div").ajaxSuccess(function() //this function will execute when file has loaded successfully from server
            {
                alert("Notepad file loaded ");
            });
            $("button").click(function() {
                $("div").load("Jquery.txt");//load method will load text file from server.
            });
        });
    </script>
</head>
<body>
<h2>JQuery ajaxComplete() method</h2> this is a heading
    <divstyle="height: 176px; width: 311px; background-color:Yellow"><!--div element is used to show notepad file -->
    </div>
    <button>
        Click to read</button>
</body>

When Click to read button is clicked popup window will show message as shown below:

jQuery ajaxComplete method

jQuery ajaxComplete method



Updated 07-Sep-2019

Leave Comment

Comments

Liked By