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
d8bad24d
Commit
d8bad24d
authored
May 20, 2006
by
Gilles van den Hoven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrote $.xml a bit, cause the loading message got stuck (didn't hide) after fast ajax calls
parent
81fda970
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
27 deletions
+21
-27
ajax.js
ajax/ajax.js
+21
-27
No files found.
ajax/ajax.js
View file @
d8bad24d
...
@@ -9,7 +9,6 @@ if ( typeof XMLHttpRequest == 'undefined' && typeof window.ActiveXObject == 'fun
...
@@ -9,7 +9,6 @@ if ( typeof XMLHttpRequest == 'undefined' && typeof window.ActiveXObject == 'fun
};
};
}
}
//
// Counter for holding the active query's
// Counter for holding the active query's
$
.
xmlActive
=
0
;
$
.
xmlActive
=
0
;
...
@@ -17,25 +16,11 @@ $.xml = function( type, url, data, ret ) {
...
@@ -17,25 +16,11 @@ $.xml = function( type, url, data, ret ) {
var
xml
=
new
XMLHttpRequest
();
var
xml
=
new
XMLHttpRequest
();
if
(
xml
)
{
if
(
xml
)
{
//
// Increase the query counter
$
.
xmlActive
++
;
//
// Show loader if needed
if
(
$
.
xmlCreate
)
{
$
.
xmlCreate
();
}
//
// Open the socket
// Open the socket
xml
.
open
(
type
||
"GET"
,
url
,
true
);
xml
.
open
(
type
||
"GET"
,
url
,
true
);
if
(
data
)
if
(
data
)
{
xml
.
setRequestHeader
(
'Content-Type'
,
'application/x-www-form-urlencoded'
);
xml
.
setRequestHeader
(
'Content-Type'
,
'application/x-www-form-urlencoded'
);
}
//
// Set header so calling script knows that it's an XMLHttpRequest
// Set header so calling script knows that it's an XMLHttpRequest
xml
.
setRequestHeader
(
'X-Requested-With'
,
'XMLHttpRequest'
);
xml
.
setRequestHeader
(
'X-Requested-With'
,
'XMLHttpRequest'
);
...
@@ -43,29 +28,38 @@ $.xml = function( type, url, data, ret ) {
...
@@ -43,29 +28,38 @@ $.xml = function( type, url, data, ret ) {
* a bug where XMLHttpReqeuest sends an incorrect Content-length
* a bug where XMLHttpReqeuest sends an incorrect Content-length
* header. See Mozilla Bugzilla #246651.
* header. See Mozilla Bugzilla #246651.
*/
*/
if
(
xml
.
overrideMimeType
)
{
if
(
xml
.
overrideMimeType
)
xml
.
setRequestHeader
(
'Connection'
,
'close'
);
xml
.
setRequestHeader
(
'Connection'
,
'close'
);
}
xml
.
onreadystatechange
=
function
()
{
xml
.
onreadystatechange
=
function
()
{
if
(
xml
.
readyState
==
4
)
{
// Socket is openend
if
(
ret
)
{
ret
(
xml
);
}
if
(
xml
.
readyState
==
1
)
{
// Increase counter
$
.
xmlActive
++
;
//
// Show loader if needed
if
(
(
$
.
xmlActive
>=
1
)
&&
(
$
.
xmlCreate
)
)
$
.
xmlCreate
();
}
// Socket is closed and data is available
if
(
xml
.
readyState
==
4
)
{
// Decrease counter
// Decrease counter
$
.
xmlActive
--
;
$
.
xmlActive
--
;
//
// Hide loader if needed
// Hide loader if needed
if
(
$
.
xmlActive
<=
0
)
{
if
(
(
$
.
xmlActive
<=
0
)
&&
(
$
.
xmlDestroy
)
)
{
if
(
$
.
xmlDestroy
)
{
$
.
xmlDestroy
();
$
.
xmlDestroy
();
$
.
xmlActive
=
0
}
}
}
// Process result
if
(
ret
)
ret
(
xml
);
}
}
};
};
xml
.
send
(
data
)
;
xml
.
send
(
data
)
}
}
};
};
...
...
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