3 // http://jquery.com/docs/ajax/
5 if ( typeof XMLHttpRequest == 'undefined' && typeof window.ActiveXObject == 'function') {
6 var XMLHttpRequest = function() {
7 return new ActiveXObject((navigator.userAgent.toLowerCase().indexOf('msie 5') >= 0) ?
8 "Microsoft.XMLHTTP" : "Msxml2.XMLHTTP");
12 $.xml = function( type, url, data, ret ) {
13 var xml = new XMLHttpRequest();
16 xml.open(type || "GET", url, true);
19 xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
22 xml.onreadystatechange = function() {
23 if ( xml.readyState == 4 ) ret(xml);
30 $.httpData = function(r,type) {
31 return r.getResponseHeader("content-type").indexOf("xml") > 0 || type == "xml" ?
32 r.responseXML : r.responseText;
35 $.get = function( url, ret, type ) {
36 $.xml( "GET", url, null, function(r) {
37 if ( ret ) ret( $.httpData(r,type) );
41 $.getXML = function( url, ret ) {
42 $.get( url, ret, "xml" );
45 $.post = function( url, data, ret, type ) {
46 $.xml( "POST", url, $.param(data), function(r) {
47 if ( ret ) ret( $.httpData(r,type) );
51 $.postXML = function( url, data, ret ) {
52 $.post( url, data, ret, "xml" );
55 $.param = function(a) {
58 s[s.length] = i + "=" + encodeURIComponent( a[i] );
62 $.fn.load = function(a,o,f) {
64 // I overwrote the event plugin's .load
65 // this won't happen again, I hope -John
66 if ( a && a.constructor == Function )
67 return this.bind("load", a);
70 if ( o && o.constructor == Function ) {
78 $.xml(t,a,o,function(h){
79 var h = h.responseText;
80 self.html(h).find("script").each(function(){
82 eval( this.text || this.textContent || this.innerHTML );