Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
484af2a4
Commit
484af2a4
authored
Sep 01, 2006
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
About half done documenting the AJAX module.
parent
34d40c3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
133 additions
and
2 deletions
+133
-2
ajax.js
src/ajax/ajax.js
+133
-2
No files found.
src/ajax/ajax.js
View file @
484af2a4
...
@@ -3,12 +3,38 @@
...
@@ -3,12 +3,38 @@
// http://jquery.com/docs/ajax/
// http://jquery.com/docs/ajax/
/**
/**
* Load HTML from a remote file and inject it into the DOM
* Load HTML from a remote file and inject it into the DOM, only if it's
* been modified by the server.
*
* @example $("#feeds").loadIfModified("feeds.html")
* @before <div id="feeds"></div>
* @result <div id="feeds"><b>45</b> feeds found.</div>
*
* @name loadIfModified
* @type jQuery
* @param String url The URL of the HTML file to load.
* @param Hash params A set of key/value pairs that will be sent to the server.
* @param Function callback A function to be executed whenever the data is loaded.
* @cat AJAX
*/
*/
jQuery
.
fn
.
loadIfModified
=
function
(
url
,
params
,
callback
)
{
jQuery
.
fn
.
loadIfModified
=
function
(
url
,
params
,
callback
)
{
this
.
load
(
url
,
params
,
callback
,
1
);
this
.
load
(
url
,
params
,
callback
,
1
);
};
};
/**
* Load HTML from a remote file and inject it into the DOM.
*
* @example $("#feeds").load("feeds.html")
* @before <div id="feeds"></div>
* @result <div id="feeds"><b>45</b> feeds found.</div>
*
* @name load
* @type jQuery
* @param String url The URL of the HTML file to load.
* @param Hash params A set of key/value pairs that will be sent to the server.
* @param Function callback A function to be executed whenever the data is loaded.
* @cat AJAX
*/
jQuery
.
fn
.
load
=
function
(
url
,
params
,
callback
,
ifModified
)
{
jQuery
.
fn
.
load
=
function
(
url
,
params
,
callback
,
ifModified
)
{
if
(
url
.
constructor
==
Function
)
if
(
url
.
constructor
==
Function
)
return
this
.
bind
(
"load"
,
url
);
return
this
.
bind
(
"load"
,
url
);
...
@@ -81,7 +107,56 @@ new function(){
...
@@ -81,7 +107,56 @@ new function(){
jQuery
.
extend
({
jQuery
.
extend
({
/**
/**
* Load a remote page using a GET request
* Load a remote page using an HTTP GET request.
*
* @example $.get("test.cgi")
*
* @name $.get
* @type jQuery
* @param String url The URL of the HTML file to load.
* @cat AJAX
*/
/**
* Load a remote page using an HTTP GET request.
*
* @example $.get("test.cgi", { name: "John", time: "2pm" } )
*
* @name $.get
* @type jQuery
* @param String url The URL of the HTML file to load.
* @param Hash params A set of key/value pairs that will be sent to the server.
* @cat AJAX
*/
/**
* Load a remote page using an HTTP GET request.
*
* @example $.get("test.cgi", function(){
* alert("Data Loaded.");
* })
*
* @name $.get
* @type jQuery
* @param String url The URL of the HTML file to load.
* @param Function callback A function to be executed whenever the data is loaded.
* @cat AJAX
*/
/**
* Load a remote page using an HTTP GET request.
*
* @example $.get("test.cgi",
* { name: "John", time: "2pm" },
* function(){ alert("Data Loaded."); }
* )
*
* @name $.get
* @type jQuery
* @param String url The URL of the HTML file to load.
* @param Hash params A set of key/value pairs that will be sent to the server.
* @param Function callback A function to be executed whenever the data is loaded.
* @cat AJAX
*/
*/
get
:
function
(
url
,
data
,
callback
,
type
,
ifModified
)
{
get
:
function
(
url
,
data
,
callback
,
type
,
ifModified
)
{
if
(
data
.
constructor
==
Function
)
{
if
(
data
.
constructor
==
Function
)
{
...
@@ -97,7 +172,63 @@ jQuery.extend({
...
@@ -97,7 +172,63 @@ jQuery.extend({
if
(
callback
)
callback
(
jQuery
.
httpData
(
r
,
type
),
status
);
if
(
callback
)
callback
(
jQuery
.
httpData
(
r
,
type
),
status
);
},
ifModified
);
},
ifModified
);
},
},
/**
* Load a remote page using an HTTP GET request, and only if it hasn't
* been modified since it was last retieved.
*
* @example $.getIfModified("test.cgi")
*
* @name $.getIfModified
* @type jQuery
* @param String url The URL of the HTML file to load.
* @cat AJAX
*/
/**
* Load a remote page using an HTTP GET request, and only if it hasn't
* been modified since it was last retieved.
*
* @example $.getIfModified("test.cgi", { name: "John", time: "2pm" })
*
* @name $.getIfModified
* @type jQuery
* @param String url The URL of the HTML file to load.
* @param Hash params A set of key/value pairs that will be sent to the server.
* @cat AJAX
*/
/**
* Load a remote page using an HTTP GET request, and only if it hasn't
* been modified since it was last retieved.
*
* @example $.getIfModified("test.cgi", function(){
* alert("Data Loaded.");
* })
*
* @name $.getIfModified
* @type jQuery
* @param String url The URL of the HTML file to load.
* @param Function callback A function to be executed whenever the data is loaded.
* @cat AJAX
*/
/**
* Load a remote page using an HTTP GET request, and only if it hasn't
* been modified since it was last retieved.
*
* @example $.getIfModified("test.cgi",
* { name: "John", time: "2pm" },
* function(){ alert("Data Loaded."); }
* )
*
* @name $.getIfModified
* @type jQuery
* @param String url The URL of the HTML file to load.
* @param Hash params A set of key/value pairs that will be sent to the server.
* @param Function callback A function to be executed whenever the data is loaded.
* @cat AJAX
*/
getIfModified
:
function
(
url
,
data
,
callback
,
type
)
{
getIfModified
:
function
(
url
,
data
,
callback
,
type
)
{
jQuery
.
get
(
url
,
data
,
callback
,
type
,
1
);
jQuery
.
get
(
url
,
data
,
callback
,
type
,
1
);
},
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment