AJAX In JQuery

Low Level AJAX

  • AJAX function is process for higher level function as load, get and post.
  • It is use two parameter name or value.
  • Declare url data, passwords, data types, filters, character sets, timeout and error functions in this parameter.

Syntax of the low level AJAX function

$.ajax(options)

Example

<!DOCTYPE html>

<html>

<head>

<script type="text/javascript" src="jquery.js"></script>

<script type="text/javascript">

    $(document).ready(function ()

 {

        $("button").click(function ()

{

            $.ajax({ url: "Textfile.txt", success: function (result)

{

                $("div").html(result);

            }

            });

        });

    });

</script>

</head>

<body>

 

<div><h2>AJAX change this text</h2></div>

<button>Click here</button>

</body>

</html>

 

Output

 

 op1.jpg

After click button

 op2.jpg

You may also want to read these related articles here