jQuery Tutorial


jQuery Example


jQuery References


jQuery with AJAX References




jQuery with AJAX Method References

All jQuery AJAX method are listed here. All jQuery AJAX work on some different purpose. which you have to binding with your program.


Method Description
$.ajax()
Use Load a remote page using an HTTP request.
Syntax $.ajax(option:value)
option option(All Operation) is a Optional. set of option and value that configure the Ajax request.
Option Description
async Request perform asynchronously. Default value is True.
beforeSend Callback function executed before request was send.
complete function is run when request is finished.
contentType which type of content use to sending to server. Default value is application/x-www-form-urlencoded.
data Specific data send to the server.
dataType Specific type of data expected back from the server. (eg. htm,js,xml etc.)
error function is execute when request is fail.
password password use to response to the HTTP access authentication request.
success function is execute when request is succeeds.
timeout Set the number of milliseconds after request will timeout in failure.
type HTTP method use in request(GET or POST). Default value is GET.
url URL which is the request is sent.
username username use to response to the HTTP access authentication request.
xhr function execute when creating the XMLHttpRequest object.
Example $.ajax({url:"ajaxfile.txt",success:function(result){
load()
Use Load URL for requested document to open.
Syntax $(selector).load(url,data,callback)
url url is required parameter. load the url file when request was found.
data data is optional parameter. data send to the server when request was found. .
callback Callback is optional parameter. It is use to represents a function to be executed whenever effect is completed.
Example $("div").load('ajaxfile.txt');
$.get()
Use request to Load URL document to open using GET.
Syntax $.get( url,[data],[callback],[type] )
url url is required parameter. String containing the URL to which the request is sent.
data data is optional parameter. data represent to the server when request was found. .
callback Callback is optional parameter. It is use to represents a function to be executed whenever effect is completed.
type type is optional parameter.type represent data returned (like html,xml,js etc.).
External File Create
(name.php)
Write Down following code in name.php file.
<?php
if( $_REQUEST["name"] )
{
   $name = $_REQUEST['name'];
   echo "Welcome ". $name;
}
?>
Example $.get("name.php",{name:"Jay"},function(data){
$.post()
Use Load URL for requested document to open using POST.
Syntax $.post( url,[data],[callback],[type] )
url url is required parameter. String containing the URL to which the request is sent.
data data is optional parameter. data represent to the server when request was found. .
callback Callback is optional parameter. It is use to represents a function to be executed whenever effect is completed.
type type is optional parameter.type represent data returned (like html,xml,js etc.).
External File Create
(name.php)
Write Down following code in name.php file.
<?php
if( $_REQUEST["name"] )
{
   $name = $_REQUEST['name'];
   echo "Welcome ". $name;
}
?>
Example $.post("name.php",{name:"Jay"},function(data){
$.getScript()
Use Load URL for requested JavaScript document to open.
Syntax $.getScript(url,[callback])
url url is required parameter. String containing the URL to which the request is sent.
callback Callback is optional parameter. It is use to represents a function to be executed whenever effect is completed.
External File Create
(namejs.js)
Write Down following code in namejs.js file.
function nameAlert(){
   alert("My Name is Jay Patel");
}
Example $.post("name.php",{name:"Jay"},function(){

Ajax Events References

Following are some Ajax Event References:


Method Description
ajaxComplete()
Use ajaxComplete method add to the function, when AJAX request completes than execute.
Syntax $[selector].ajaxComplete([callback])
callback Callback is optional parameter. It is use to represents a function to be executed whenever effect is completed.
External File Create
(ajaxfile.html)
Write Down following code in ajaxfile.html file.
<html>
<body>
<p>Ajax is use to jQuery to open URL 
documents with in the documents</p>
<br />
<p>AJAX = Asynchronous JavaScript a
nd XML</p>
</body>
</html>
Example $("button").ajaxComplete(function(){
ajaxStart()
Use ajaxStart method add to the function, when AJAX request begin than execute.
Syntax $[selector].ajaxStart([callback])
callback Callback is optional parameter. It is use to represents a function to be executed whenever effect is completed.
External File Create
(ajaxfile.html)
Write Down following code in ajaxfile.html file.
<html>
<body>
<p>Ajax is use to jQuery to open URL 
documents with in the documents</p>
<br />
<p>AJAX = Asynchronous JavaScript a
nd XML</p>
</body>
</html>
Example $("button").ajaxStart(function(){
ajaxError()
Use ajaxError method add to the function, when AJAX request fails than execute.
Syntax $[selector].ajaxError([callback])
callback Callback is optional parameter. It is use to represents a function to be executed whenever effect is completed.
External File Create
(ajaxfile.jhtml)
Write Down following code in ajaxfile.html file.
<html>
<body>
<p>Ajax is use to jQuery to open URL 
documents with in the documents</p>
<br />
<p>AJAX = Asynchronous JavaScript a
nd XML</p>
</body>
</html>
Example $("button").ajaxError(function(){
ajaxStop()
Use ajaxStop method add to the function, when AJAX request stop than execute.
Syntax $[selector].ajaxStop([callback])
callback Callback is optional parameter. It is use to represents a function to be executed whenever effect is completed.
External File Create
(ajaxfile.jhtml)
Write Down following code in ajaxfile.html file.
<html>
<body>
<p>Ajax is use to jQuery to open URL 
documents with in the documents</p>
<br />
<p>AJAX = Asynchronous JavaScript a
nd XML</p>
</body>
</html>
Example $("button").ajaxStop(function(){
ajaxSuccess()
Use ajaxSuccess method add to the function, when AJAX request successfully completed than execute.
Syntax $[selector].ajaxSuccess([callback])
callback Callback is optional parameter. It is use to represents a function to be executed whenever effect is completed.
External File Create
(ajaxfile.jhtml)
Write Down following code in ajaxfile.html file.
<html>
<body>
<p>Ajax is use to jQuery to open URL 
documents with in the documents</p>
<br />
<p>AJAX = Asynchronous JavaScript a
nd XML</p>
</body>
</html>
Example $("button").ajaxSuccess(function(){