eristoddle
10/30/2012 - 8:43 PM

Jquery Ajax complete b4 pageload - one way

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;
	    	}
    	}
    });