I'm using jquery.mobile-1.1.0.min.js and cordova-2.0.0.js (phonegap).
In my setup for my $.ajax call I set my params like this:
The function onFetchOK gets 18 message headers back from the server, each message header has an id, subject and a date/time and these get stored in the webdb using the phonegap webdb storage API.
If I drop and recreate the message table and run the app fresh, the ajax complete: function gets called once for each of the 18 messages I receive so 342 message headers gets displayed (18x18+18).
No where in my code other than this one $.ajax complete: does showAllHeaders(); get called.
I placed an alert inside the showAllHeaders() and that alert gets triggered 19 times.
To narrow this down further I placed a loop counter inside my $.ajax success: onFetchOK() like this:
When this alert is called it shows "loopCount = 18" and this is called/displayed only once.
If I exit the app, reload it and no new messages are pulled from the server then 18 message headers are displayed, which is exactly as it should be.
So, it appears that my complete: function() is being called repeatedly... once as it should and then 18 more times (effectively once for each message header retrieved).
Anyone have any idea why this would be?