suslovalexxxx
New Member
I have this example, when my form is submitted I have to load an image file and wait until the image has loaded to \[code\]return true\[/code\] (in this case to submit the form)ex\[code\]$('#myform').submit(function(){ var image=document.createElement('image') var src=http://stackoverflow.com/questions/15605522/document.createAttribute('src') image.value="http://example.com/image.jpg" image.setAttributeNode(src); document.body.appendChild(image);})\[/code\]Here if I \[code\]return true\[/code\] the form will be submitted (the image won't load) and if \[code\]false\[/code\] 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.