Apologies for the poorly worded question, but I'm struggling to find a better way to phrase it.
I'm currently working with a .each() loop where I need to update a specific css() parameter of each item in the loop. However, I can't seem to get it right.
Below is the code snippet I'm using:
$(document).find('.test').find('p').each(function(){
var test=$(this).css('background-image').split('(')[1].split(')')[0];
var retGet=$.get(test);
$(this).css({
'background-image': 'url(data:image/png;base64,'+retourGet.responseText+')'
});
});
I've omitted the url editing part (the second line provides the current url which I edit).
Unfortunately, when running this code, I receive undefined values in my css parameters. It appears that the $.get loading process isn't complete before I try to change the background image.
I attempted something like this:
$.get( test, function( data ) {
});
But I'm unsure how to access the individual $(this) element within the .each() loop here.