Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ajaxAction: function(action, args, callback, tries) {
- if(tries == undefined) tries = 1;
- var attempt = 1,
- interval = 1000;
- makeRequest();
- function makeRequest(){
- new app.Request('/ajax/'+action+'.json',
- $.extend({}, args, {submitted:1}),
- callback,
- handleError,
- 'POST',
- 'json');
- }
- function handleError(){
- if(attempt < tries)
- setTimeout(function(){ makeRequest(); }, interval);
- attempt++;
- }
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement