jQuery, AJAX and PhoneGap (oh, my!)

jQuery, AJAX and PhoneGap (oh, my!)

I am developing my first (production) PhoneGap app. I'm using jQuery 1.10.2. According to the jQuery doc:"As of jQuery 1.8, the .ajaxComplete() method should only be attached to document."

In my prototype page, I did just that and attached the handlers to $(document).

  1. $(document).ajaxSend(function (data, hdr, settings) {
  2. // stuff
  3. }).ajaxComplete(function (ev, req, options) {
  4. // stuff
  5. }).ajaxError(function (err, data, status, exc) {
  6. // stuff
  7. }).ajaxSuccess(function (xhdr, data, settings) {
  8. // stuff
  9. });

This works in my browser, but not in PG.  In PG, I have to attach the handlers to the $.ajax() call itself.

  1. $.ajax({
  2. url: url,
  3. type: "get",
  4. dataType: "JSONP",
  5. contentType: "application/json;charset=utf-8"
  6. }).always(function (data, hdr, more) {
  7. // stuff
  8. }).error(function (data, err, status) {
  9. // stuff
  10. }).success(function (data, status, more) {
  11. // stuff
  12. });    

Is this a known issue? Is it an issue with PG? 

It's not a show stopper by any means, but I really don't want to maintain 2 different methods of maintaining AJAX calls between web site and PhoneGap.

Thoughts?  TIA!