How to use Selector in AJAX JQuery
This article describe about jQuery AJAX selector.
Use of selector in jQuery AJAX
AJAX function is used load() method in jquery.
Selector to define the HTML element(s) change, and the url parameter to specify a web address for our data.
Syntax of AJAX function
$(selector).load(url,data,callback) |
Here is the description of all the parameters
- URL- URL is load data CGI, ASP, JSP, PHP script out of a database.
- Data- Post the methos, the GET method is used.
- Callback- Response for loaded data and matched two way, parameter passed to this function and parameter code.
Example
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("button").click(function () {
$("div").load('textfile.txt');
});
});
</script>
</head>
<body>
<div><h2>AJAX change this content</h2></div>
<button>Click here</button>
</body>
</html>
|
Output
After click button
You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here