Created
October 30, 2012 20:43
-
-
Save eristoddle/3982893 to your computer and use it in GitHub Desktop.
Jquery Ajax complete b4 pageload - one way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#edit-next').click(function(){ | |
//TODO: Check that image is selected before proceeding | |
var actionA = $('.node-photo-form').attr('action').split('?'), | |
apiImage = $('.selected-photo img').attr('data-photo-url'); | |
if(apiImage){ | |
if($('#edit-field-photo input[value="Remove"]').length){ | |
return true; | |
}else{ | |
$('.node-photo-form').attr('action',actionA[0]) | |
$('.filefield-source-remote').triggerHandler('click'); | |
$('.filefield-source .form-text').val(apiImage); | |
$('input[value="Transfer"]').triggerHandler('mousedown'); | |
$('#edit-field-photo input[value="Remove"]').livequery( | |
function(){ | |
$('#edit-next').click(); | |
}, | |
function(){} | |
); | |
return false; | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment