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
b07d43c6
Commit
b07d43c6
authored
Jan 13, 2011
by
jaubourg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleans up statusText handling and simplifies 304 notmodified logic.
parent
97b24431
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
ajax.js
src/ajax.js
+17
-13
No files found.
src/ajax.js
View file @
b07d43c6
...
@@ -365,17 +365,10 @@ jQuery.extend({
...
@@ -365,17 +365,10 @@ jQuery.extend({
// Stored success
// Stored success
success
,
success
,
// Stored error
// Stored error
error
=
statusText
;
error
;
// If not timeout, force a jQuery-compliant status text
if
(
statusText
!=
"timeout"
)
{
statusText
=
(
status
>=
200
&&
status
<
300
)
?
"success"
:
(
status
===
304
?
"notmodified"
:
"error"
);
}
// If successful, handle type chaining
// If successful, handle type chaining
if
(
status
Text
===
"success"
||
statusText
===
"notmodified"
)
{
if
(
status
>=
200
&&
status
<
300
||
status
===
304
)
{
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if
(
s
.
ifModified
)
{
if
(
s
.
ifModified
)
{
...
@@ -391,12 +384,20 @@ jQuery.extend({
...
@@ -391,12 +384,20 @@ jQuery.extend({
}
}
}
}
if
(
s
.
ifModified
&&
statusText
===
"notmodified"
)
{
// If not modified
if
(
status
===
304
)
{
success
=
null
;
// Set the statusText accordingly
statusText
=
"notmodified"
;
// Mark as a success
isSuccess
=
1
;
isSuccess
=
1
;
// If we have data
}
else
{
}
else
{
// Set the statusText accordingly
statusText
=
"success"
;
// Chain data conversions and determine the final value
// Chain data conversions and determine the final value
// (if an exception is thrown in the process, it'll be notified as an error)
// (if an exception is thrown in the process, it'll be notified as an error)
try
{
try
{
...
@@ -487,17 +488,20 @@ jQuery.extend({
...
@@ -487,17 +488,20 @@ jQuery.extend({
success
=
response
;
success
=
response
;
isSuccess
=
1
;
isSuccess
=
1
;
// If an exception was thrown
}
catch
(
e
)
{
}
catch
(
e
)
{
// We have a parsererror
statusText
=
"parsererror"
;
statusText
=
"parsererror"
;
error
=
""
+
e
;
error
=
""
+
e
;
}
}
}
}
}
else
{
// if not success, mark it as an error
// if not success, mark it as an error
}
else
{
error
=
error
||
statusText
;
error
=
statusText
=
statusText
||
"error"
;
// Set responseText if needed
// Set responseText if needed
if
(
response
)
{
if
(
response
)
{
...
...
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