Skip to content

Instantly share code, notes, and snippets.

@eristoddle
Created October 30, 2012 20:43
Show Gist options
  • Save eristoddle/3982893 to your computer and use it in GitHub Desktop.
Save eristoddle/3982893 to your computer and use it in GitHub Desktop.
Jquery Ajax complete b4 pageload - one way
$('#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