Commit graph

294 commits

Author SHA1 Message Date
jaubourg fef0f63526 Rewrote the data conversion logic in ajax. Should be cleaner and faster. 2010-12-31 03:56:10 +01:00
jaubourg 4c49c87d4d Renamed jQuery.xhr.bindTransport as jQuery.xhr.transport. Generalized the implementation and made prefilters use the same logic. Cleaned up code and removed as many loops and each as possible. 2010-12-31 03:53:00 +01:00
Colin Snover 3e0cc81504 Clean trailing whitespace from all files. 2010-12-30 00:34:48 -06:00
Ben Alman 78a6f5b152 Removed unnecessary upper/lowercase, it's all just lowercase now (since $.ajax will uppercase as-needed). 2010-12-26 22:49:01 +00:00
Ben Alman 1830db4226 WETness getting you down? Fear not, the $.get and $.post methods are now 866% DRYer. This fixes #7847. 2010-12-26 18:52:27 +00:00
Colin Snover 1f92edee20 Fix fix for #6481 introduced at 7862c45ad2 which did not like it when Array.prototype was modified on empty arrays. 2010-12-22 18:54:22 -06:00
jaubourg ab74d8e6a0 Fix the closure in ajax.js too. 2010-12-10 03:16:50 +01:00
jaubourg ab3ba4a812 Rewrite of the Ajax module by Julian Aubourg. Some (dated) details can be found here: http://oksoclap.com/6Y26bm1ZsB more details are forthcoming. Fixes #7195. 2010-12-09 13:34:28 -05:00
John Resig 9759e9f6bb Merge branch 'bug6242' of https://github.com/csnover/jquery into csnover-bug6242 2010-12-06 17:23:08 -05:00
John Resig 6c68124928 Merge branch 'bug7531' of https://github.com/csnover/jquery into csnover-bug7531 2010-12-06 17:22:02 -05:00
Colin Snover 238ac5a0aa Fix memory leaks in IE caused by the custom abort function of $.ajax. Fixes bug #6242. 2010-12-03 00:12:52 -06:00
Anton M 8259efe734 Set cache to false as default for script or json requests. Fixes 7578. 2010-11-19 23:14:24 +01:00
Colin Snover c04500a834 Optimize for size instead of speed. 2010-11-17 14:50:05 -06:00
Colin Snover 2a0c7d702b Coerce s.url to string before calling replace, since replace is also a method of a Location object. Fixes #7531. 2010-11-17 00:59:24 -06:00
John Resig aa74396976 Merge branch 'bug7422' of https://github.com/csnover/jquery into csnover-bug7422 2010-11-09 12:40:55 -05:00
John Resig fb48ae8e6c Make sure that when multiple variables are being declared that assignments are each done on their own line. 2010-11-09 11:09:07 -05:00
Colin Snover e57b73a0ac Ensure that AJAX requests are actually aborted in all browsers. Fix #7422. 2010-11-06 13:52:30 -05:00
John Resig de58db0cdf Backing out fix for #5803 from 3b50eaca2c. 2010-10-25 17:54:27 -07:00
John Resig a4fc842019 Merge branch 'jquerymaster' of http://github.com/SlexAxton/jquery into SlexAxton-jquerymaster 2010-10-25 13:06:55 -07:00
dmethvin 09022e0b09 Allow DELETE requests to have a content body, and properly serialize data to the url for HEAD requests. Fixes #7285. 2010-10-25 13:06:02 -07:00
rwldrn 3b50eaca2c Fixes #7229 and #5803 2010-10-24 12:18:33 -04:00
Alex Sexton a58f8f22d1 Forces lower case comparison of protocol and host when determining whether the request is remote or local. Fixes #6908 2010-10-20 21:12:47 -07:00
John Resig 497fc9849e Bringing back the change from 80a4178af9, adapted to handle both the function collision and the issue mentioned in #7196. 2010-10-15 01:29:38 -04:00
jeresig 80a4178af9 Reverting commit 39addc87a3 after a report of problems. Fixes #7196. 2010-10-14 20:55:40 -04:00
jeresig d490bcfa7c Oops, still have jQuery.ajax.* on the brain. 2010-10-13 21:25:23 -04:00
Pinhook 39addc87a3 Handle issue with two concurrent JSONP requests that use the same callback name. 2010-10-13 10:30:19 -04:00
John Resig 6245ecb2b9 The world isn't ready for moving the Ajax methods to jQuery.ajax.*. Hope to move them there some day. Fixes #7146. 2010-10-11 18:29:52 -04:00
John Resig 9b655a176b Merge branch 'bug7018' of http://github.com/csnover/jquery into csnover-bug7018 2010-10-09 16:25:55 -04:00
jeresig da597bcf90 Name the try/catch arg to satisfy JSLint - thanks to @rwldrn in 873c28425f for the catch. 2010-10-09 12:26:44 -04:00
Colin Snover d2e64979bf Fix bug #7018. 2010-10-06 03:03:28 -05:00
John Resig 873c28425f Make sure we have a fallback when XMLHttpRequest is manually disabled. Fixes #6298. 2010-09-28 10:12:33 -07:00
jeresig e63fa8beb8 Merge branch 'master' of http://github.com/aakoch/jquery into aakoch-master 2010-09-27 14:49:13 -04:00
Dave Methvin c4e653237f Make sure that requests without a body don't set contentType, and a zero-length body is sent rather than null. Possible fix for #6811 and #6674. 2010-09-24 17:56:03 -04:00
Dave Methvin 1130beb72b Report correct Error object to handleError. Part of the fix for #6677. 2010-09-24 17:47:37 -04:00
jeresig 700ff05af0 Merge branch 'master' of github.com:jquery/jquery 2010-09-24 17:05:28 -04:00
Dave Methvin 395a032ad8 Use origSettings.context unless it's undefined; for that case use merged settings as context for backcompat with jQuery <1.3. Fixes #6727. 2010-09-24 17:04:54 -04:00
dmethvin c8c8f8458a For JSON and script requests, set the scriptCharset before the url so IE won't interpret it the wrong way; fixes #4855. 2010-09-25 05:01:31 +08:00
Heungsub Lee 033a4c41e0 Added a default quality of */* for content negotiation. 2010-09-25 05:00:18 +08:00
temp01 7862c45ad2 Serialize keys with empty arrays/object values in jQuery.param(). Fixes #6481. 2010-09-24 16:57:25 -04:00
unknown a088751a1b Removing the second capture group. After the changes suggested by Jeff Roberson, the second capture group is no longer needed. See
http://stackoverflow.com/questions/3771105/can-someone-tell-me-the-purpose-of-the-second-capture-group-in-the-jquery-rts-reg
2010-09-24 09:37:03 -05:00
jeresig ab454d9526 Allow # urls to contain #. Thanks to @alvopass in f9f9ee52e1 for the catch. 2010-09-22 14:58:07 -04:00
John Resig f9f9ee52e1 Make sure that #... are trimmed from Ajax request URLs. Fixes #4987. 2010-09-22 12:52:44 -04:00
jeresig 9dc6e0c572 Applied the RegExp issues reported by Jeff Robinson here: http://jmrware.com/articles/2010/jqueryregex/jQueryRegexes.html Additionally broke out all remaining inline RegExp. Fixes #7062. 2010-09-22 09:16:28 -04:00
John Resig dc8491defe Scratch that, just punting on Opera and 304s for now - there may not be a good solution here. Fixes #6060. 2010-09-21 16:13:50 -04:00
John Resig ba9e0fc177 Use a different workaround for detecting when Opera finds a status 304 page. Fixes #6060. 2010-09-21 15:22:34 -04:00
John Resig 959c20f768 Add a flag to verify if a browser supports some form of XHR request. Fixes #7030. 2010-09-13 18:02:33 -04:00
jeresig bca5765502 Make sure that jQuery works even when the individual modules are loaded separately AND jQuery.noConflict(true) is used. Fixes #7011. 2010-09-08 13:54:33 -04:00
jeresig c90d609c0d Fixing request data param issue. Thanks to mislav for the patch. Fixes #5123. 2010-06-14 23:08:28 -04:00
jeresig c34a62f8ab Tweak spacing from last commit. 2010-06-14 23:05:01 -04:00
malsup d1931a8241 Fix for http://dev.jquery.com/ticket/6451 2010-06-15 11:02:26 +08:00
jeresig 8effe3a7de Made it so that you no longer need to build jQuery in order to run the test suite (but you'll still need a checkout of QUnit and Sizzle, at least). 2010-03-23 12:12:16 -04:00
jeresig 86ace44fbb Moving more properties onto jQuery.ajax, also copy them back to the jQuery object for backwards compatibility. 2010-03-02 10:44:48 -05:00
jeresig dcf0fa5048 More changes to get jQuery in line with JSLint. 2010-03-01 21:24:49 -05:00
jeresig 8c8f685a91 We don't want to increment the Ajax counter if there isn't a global event. 2010-03-01 19:31:13 -05:00
jeresig a4043cdcbf Land some additional tweaks related to running through JSLint. 2010-03-01 18:19:29 -05:00
jeresig a18f682012 Made some code tweaks related to running jQuery through JSLint (thanks to Lorin Larson for the JSLint run). 2010-03-01 12:44:56 -05:00
jeresig a45372a4c5 Adding in .bind(name, false), .unbind(name, false) support - an easy way to just stop bubbling and the default action on an element. Fixes #6188. 2010-02-27 09:02:13 -05:00
John Resig 639f4931b0 No reason to expose the temporary _load method. 2010-02-11 01:23:13 -05:00
Ben Alman 3c5b1ca03b Ok, this should actually fix #6041 :) 2010-02-06 11:46:44 +08:00
jeresig 54bd004e53 Make sure that we don't try to double-encode params using the traditional style. Fixes #6041. 2010-02-05 19:43:31 -05:00
Mike Alup ca90ffb332 Provided detailed message for JSON parse errors. Fixes #4435. 2010-01-25 18:48:52 -05:00
John Resig 1a14a38ff7 Make sure original context is maintained and not the deep extended one. Fixes #5924. 2010-01-25 01:08:24 -05:00
John Resig f91b944cab Objects with length properties weren't getting serialized properly by jQuery.param(). Fixes #5862. 2010-01-25 00:46:03 -05:00
John Resig 76236a1506 Use alternative technique for triggering an abort, preventing an exception from being thrown in Firefox. Fixes #5923. 2010-01-24 22:13:52 -05:00
John Resig c639405c4d Don't set the context in .load() as it stops the global ajax events from firing. Fixes #5922. 2010-01-24 21:58:32 -05:00
jeresig 0912109ffc Expose the JSON parsing logic. Fixes #5914. 2010-01-23 16:51:51 -05:00
jeresig a6ef036bb6 Centralize the logic for throwing exceptions. Fixes #5913. 2010-01-23 16:48:47 -05:00
John Resig 155ecf42a0 Make sure regular settings object is set as context for all Ajax requests, if none is specified. Fixes #5838. 2010-01-16 10:11:01 -05:00
jeresig 05aaa33957 Make sure that null params aren't traversed. Fixes #5794. 2010-01-13 09:29:01 -05:00
jeresig 23492fdf9f Send data if a DELETE Ajax request is done. Fixes #5752. 2010-01-13 00:42:22 -05:00
jeresig b5f077ae6a Make sure that the xhr object still exists after the abort is called. 2010-01-12 21:44:37 -05:00
jeresig 61983cbf17 Make sure oldAbort is only called if the xhr object still exists. 2010-01-12 16:50:59 -05:00
jeresig dd45c324ec Simplified some of the logic for handling the ajax aborts, making sure that ajaxStop isn't called twice. 2010-01-12 10:59:50 -05:00
jeresig d60b197810 ajaxStop was getting called too many times, separated some of the logic into the abort method itself. 2010-01-12 10:47:00 -05:00
jeresig 7afe6dcc08 Make sure that Opera fires events after an aborted Ajax attempt. Fixes #5787. 2010-01-12 10:31:51 -05:00
jeresig 44e6beb103 Make sure we do the malformed JSON check for all both JSON.parse and new Function (this helps to create uniformity between browser implementations of JSON.parse - like where Chrome allows some malformed strings. Thanks to DBJDBJ for the heads-up. 2010-01-11 16:43:21 -05:00
jeresig a9665bbe9b Make sure the exception has some level of parity with the error from json2.js. 2010-01-07 12:25:50 -05:00
jeresig 308d6cdad0 Make sure that a parsererror is thrown whenever malformed JSON comes back from a server (so that the Ajax error handler is called). Makes it uniform across browsers that do and don't have JSON.parse support. 2010-01-07 12:21:58 -05:00
jeresig c14fa516ae Back out the try/catch logic from around JSON.parse. We should always try to use it, otherwise security will suffer. 2010-01-07 11:54:26 -05:00
jeresig c68fbc2071 There's enough logic going on in jQuery.ajaxSettings.xhr to warrant splitting the function based upon the functionality. 2010-01-07 10:00:55 -05:00
jeresig 6861b5d4eb Added in support for content-type sniffing for scripts. Fixes #5718. 2010-01-06 10:19:38 -05:00
Rick Waldron 787f271052 Detect JSON Ajax requests by the response content-type (like is done with XML). Fixes #5709. 2010-01-05 19:48:16 -05:00
jeresig ff3645ee05 Try to use the native JSON parser in all cases and fallback to the old technique otherwise. This allows us to also handle cases where the JSON parser is unable to parse JSON-like strings correctly (e.g. {foo:bar}) which is something that worked before but would stop working with the switch to the new parser. 2010-01-05 17:33:41 -05:00
jeresig 3f648c4e3a Make sure that the ActiveX exception is caught if it's unable to be loaded. Fixes #2849. 2010-01-05 11:35:11 -05:00
jeresig b2289f3ec1 Try to use XMLHttpRequest in more cases in IE 7. Thanks to Matt Kruse and Sam Collett for the suggestions. Fixes #3623, #2849, #5338, and #5529. 2010-01-05 10:57:30 -05:00
jeresig 6cb2945837 Rather than declaring empty anonymous functions all around, introduce and use a single empty function. Thanks to Matt Kruse for the suggestion. 2009-12-31 09:50:49 -05:00
jeresig fe6c86d530 Experiment switching to using onreadystatechange rather than a setInterval for Ajax requests. Fixes #5735. 2009-12-30 23:53:06 -05:00
Ben Alman 3951894504 Moved jQuery.param "traditional" flag into jQuery.ajaxSettings, can now be overridden via 2nd argument to jQuery.param 2009-12-23 01:49:53 +08:00
jeresig 3776cbe314 Standardize on using double-quotes for string literals. 2009-12-21 20:13:16 -05:00
jeresig 61e37d4149 Made a number of spacing changes to bring the code more-inline with the jQuery Core Style Guideline. 2009-12-21 19:58:13 -05:00
Dave Methvin fe7e2fee16 Ignore case of script tags to make sure they're removed. Fixes #5668. Thanks to Motty/Fudgey for the report and Jitter for the patch! 2009-12-18 04:06:54 +08:00
Dave Methvin b31b9bd756 Add new html5 input types to list of serializable types. Older browers handle these as type="text" so they should be consistently serialized on both old and new browsers. Fixes #5667. 2009-12-18 04:05:45 +08:00
Dave Methvin d85d366fbf Default callbackContext to the $.extended ajax options for 1.3.2 compatibility, per #5654. 2009-12-18 04:01:39 +08:00
Ben Alman 04b92e7831 Reorganized param code slightly to once again define buildParams as a named function expression, as moving it outside the param closure would necessitate moving and rewriting the add function as well. 2009-12-18 04:01:05 +08:00
Ben Alman 927e1966de Further modified jQuery 1.4 .param() method to serialize arrays containing non-scalar values. PHP and jQuery BBQ can both deserialize these structures, while rack (as of 1.0.0) cannot. 2009-12-18 04:01:05 +08:00
John Resig 9e60fec46b Make sure that an actual timeout is triggered (and not accidentally triggered from a setInterval). Fixes #5609. 2009-12-09 08:09:41 -08:00
John Resig fbc73d45b4 Added in support for $.ajax jsonpCallback (allowing you to specify the name of the callback method - and allowing you to avoid skipping the cache). Fixes #4206. 2009-12-06 17:17:14 -08:00
jeresig 9c1db29a06 Adding in an extra check, per the comments in 25b0ba9f96. 2009-12-05 18:06:27 -05:00
John Resig 25b0ba9f96 Allow the user to explicitly set a content-type header even when there's no data being sent to the server. Fixes #1900. 2009-12-04 21:20:58 -05:00
Karl Swedberg ddb86f8d5b added curly braces around all if/else statements 2009-11-28 04:09:14 +08:00
John Resig a7678267d8 Disable the X-Requested-With header to avoid preflighting remote POST requests. Fixes #4601. 2009-11-25 13:29:34 -05:00
John Resig 0f6e9a8c69 Fixed spacing on the modified Ajax code. 2009-11-25 13:24:24 -05:00
John Resig 357e2ae989 Added a check to make sure that a load request isn't done if the element doesn't exist. Fixes #4235. 2009-11-11 14:55:32 -05:00
John Resig c2101245c0 Pass in the XHR object as the third argument to the success callback (which helps $.get, $.post, and load). Fixes #3363. 2009-11-11 14:29:01 -05:00
John Resig 6a722e251d jQuery.ajax modified the passed-in object only to help test the code - this shouldn't occur. Fixes #5439. 2009-11-07 16:08:07 +01:00
John Resig 513053d62b The complete event wasn't getting called on local file 404s. Thanks to 'mrspeaker' for the patch. Fixes #5468. 2009-11-07 14:59:47 +01:00
visionmedia 50cf4351a6 Consistant splits using " " instead of ","
This was used in several other areas, and IMO is easier to read
and since nothing is multi-word then we misewell use " "
2009-10-27 08:40:59 +08:00
Yehuda Katz 67089eedf6 Getting $.param working well; Patch by ben_alman 2009-09-17 22:37:19 +00:00
Ariel Flesler cf8c1249d1 jquery ajax: addition for #2452. Wasn't working correctly in some cases. 2009-09-15 16:45:37 +00:00
Ariel Flesler 5b9214e7d8 jquery ajax: closes #2452. get() and post() weren't shifting all arguments correctly. 2009-09-15 15:28:28 +00:00
Ariel Flesler 183f37e4b4 jquery ajax: closes #4994. Adding 'context' setting to $.ajax 2009-09-15 15:19:58 +00:00
Brandon Aaron 4a3c4c86c9 fix for #5017 2009-09-14 20:55:40 +00:00
Ariel Flesler 36ebb4f75e jquery ajax: Misc rename 2009-09-14 19:57:49 +00:00
Yehuda Katz 50d78e7658 Adds nested param serialization; Closes #4201 (by merbjedi) 2009-09-02 05:16:21 +00:00
John Resig f52c4a3d5f If the XHR object no longer exists assume that the request was aborted. 2009-08-26 17:39:52 +00:00
John Resig 8c18dcdeb0 Make sure payload is sent for PUT requests. (Thanks alx). Fixes #4971. 2009-07-27 19:02:40 +00:00
John Resig fe80b5af45 Make sure that the script is removed only if it's actually in the page still. Fixes #4934. 2009-07-22 14:38:21 +00:00
John Resig eaca153aea Moved the RegExp in ajax.js out from inline, goes towards ticket #4111. 2009-07-19 19:44:15 +00:00
John Resig 5272ed28bc Made a number of syntax tweaks to ajax.js. 2009-07-19 19:37:11 +00:00
John Resig fa2d663639 Did some cleaning up of ajax.js and fixed a bug from commit [6457]. 2009-07-19 19:03:18 +00:00
John Resig 81985c7878 Fixed a typo with commit [6457]. 2009-07-19 17:02:01 +00:00
John Resig 48e9a39995 Standardize on using .nodeName in place of .tagName. Fixes jQuery bug #4923. 2009-07-19 13:32:53 +00:00
John Resig 0d5c3a68a0 Standardizing on .test() and .exec() - moving away from using .match() for RegExp. Fixes jQuery bug #4113. 2009-07-19 13:21:51 +00:00
John Resig c3c94823f2 Fixed the handling of .status == 304 in Opera (it always returns 0). Also silently "pass" in Opera 9.6 (which is unable to send the correct headers with setRequestHeader). Follow-up to bug #4764. 2009-07-14 21:13:23 +00:00
John Resig 28ab4d3224 Adding support for etags in $.ajax() - and simplified the if-modified-since implementation. Thanks to Lawrence for the patch! Closes ticket #4764. 2009-06-15 13:36:12 +00:00
John Resig 90a87c03b4 Switched to using new Function instead of eval for handling JSON parsing (Fixes bug #4680). Added support for JSON.parse, if it exists (Fixes bug #4429). 2009-05-20 21:28:48 +00:00
Brandon Aaron e10e625bf4 fix for #4183 2009-05-16 20:23:58 +00:00
Brandon Aaron 611d24086c fix for #4378, base tag causes javascript error in IE when loading cross-domain JS via ajax 2009-03-27 18:20:57 +00:00
Brandon Aaron f8ef75eb91 remove trailing spaces 2009-03-23 01:55:17 +00:00
John Resig ca79d866fe Made it so that search input elements are now serialized. Fixes bug #4107. 2009-02-18 19:43:14 +00:00
John Resig a894c60489 Stopped a memory leak on getScript calls. Fixes #3962. 2009-02-07 16:57:59 +00:00
John Resig 00b70c7527 Landed a fix for timeouts not being aborted properly. Fixes jQuery bug #3874. 2009-01-21 21:46:53 +00:00
Ariel Flesler ddec4fdc34 jquery ajax: File size optimization for compressed code. 2009-01-04 21:15:02 +00:00
John Resig 434b87b8a2 Moved from the old JSMin to using YUIMin for compressing the jQuery source. Additionally landed some improvements from #3770 which dramatically reduce the filesize. The final minifed + gzipped size of jQuery went from 19817 bytes to 18063 bytes. 2009-01-04 15:29:27 +00:00
John Resig b850ab2b8e Added the new jQuery.support object and removed all uses of jQuery.browser from within jQuery itself (while simultaneously deprecating the use of jQuery.browser). 2008-12-21 21:22:44 +00:00
John Resig d81dfbcccf The code for handling Ajax timeouts was broken (the abort was being called too early). Fixing this allows the test suite to work again. 2008-11-18 04:53:34 +00:00
John Resig ab551c2b14 Standardized the type checks across core. isFunction and isArray now use Object.prototype.toString to verify the type, .constructor use was removed in favor of typeof, typeof checks now use ===, undefined checks use === undefined. All of this is outlined in the new style guidelines: http://docs.jquery.com/JQuery_Core_Style_Guidelines#Type_Checks. Fixes bug #3618. 2008-11-17 16:32:05 +00:00
John Resig 0aa8d40cdf Landing fixes for tickets #2935 and #2688 (Aborting ajax doesn't stop the setInterval, ajaxStop event isn't getting triggered). 2008-11-14 04:16:00 +00:00
Ariel Flesler 325755d4b3 jquery core: closes #3541. Added isArray. 2008-10-29 02:01:22 +00:00
Ariel Flesler 5dc7bb7233 jquery ajax: closes #3249. Slight modification on serializeArray, shorter and faster code, and allows a custom form object. 2008-08-13 01:44:36 +00:00
Ariel Flesler c9c024280a jquery ajax: misc optimization for $.fn.load(). 2008-08-11 01:35:23 +00:00
Ariel Flesler bf6f7e7a63 jquery ajax: closes #3231. The ajax setting 'dataFilter' can also parse the response. 2008-08-07 20:41:05 +00:00
Ariel Flesler 9d9c4d2a51 jquery ajax: extends #3087. The xhr factory is now an ajax setting called 'xhr' instead of a method (jQuery.getAjaxTransport). 2008-08-07 13:07:21 +00:00
Ariel Flesler b8ceedbe2b jquery ajax: closes #3087, #2167, #2128. The ajax transport creation process is exposed to allow overriding. 2008-08-04 14:18:06 +00:00
Ariel Flesler bf14ac1236 jquery ajax: added a comment explaining the last commit. 2008-06-17 21:31:57 +00:00
Ariel Flesler 35b8157507 jquery ajax: closes #3052. Additional check on httpData() to keep compatibility with older code (form plugin). 2008-06-17 21:03:20 +00:00
Ariel Flesler 335b8816c2 jquery ajax: Fixes #3045. The protocol wasn't being checked to see if a script is required for cross domain requests. 2008-06-17 20:32:15 +00:00
Ariel Flesler c90fe0283b jquery ajax: passing the settings object to httpData instead of just the dataFilter, so that when called it retains the object as "this". 2008-06-05 20:00:50 +00:00
Ariel Flesler 11761def42 jquery ajax: small (misc) improvement to $.param. 2008-05-28 02:50:38 +00:00
Ariel Flesler 7ec772374d jquery ajax: Closes #1516. load() can get a string of data (not only a hash) and it'll be a GET request. 2008-05-27 22:44:06 +00:00