I have this example, when my form is submitted I have to load an image file and wait until the image has loaded to return true
(in this case to submit the form)
e.g.
$('#myform').submit(function(){
var image=document.createElement('image')
var src=document.createAttribute('src')
image.value=http://example.com/image.jpg
image.setAttributeNode(src);
document.body.appendChild(image);
})
Here if I return true
the form will be submitted (the image won't load) and if false
it won't (the image will load but the form will not be submitted). How can I make a code that will return true after the image has loaded.