The problem I was having, is that I kept adding a semi-colon ; at the end of the url() value, which prevented the code from working.
❌ NOT WORKING CODE:
$('#image_element').css('background-image', 'url(http://example.com/img.jpg);');
//--------------------------------------------------------------------------^
✅ WORKING CODE:
$('#image_element').css('background-image', 'url(http://example.com/img.jpg)');
Notice the omitted semi-colon ; at the end in the working code. I simply didn't know the correct syntax, and it's really hard to notice it. Hopefully this helps someone else in the same boat.