Javascript Async Promises

Job ID: 31699144

Budget: $10 – $30 USD

I have created a page (https://layouts.nextid.com/icef/type1/qrtest_with_logo_insert_by_qrcode_monkey.htm) that enables a user to test an API function, in this case for generating QR codes with embedded logos.

If you view the source, you can see that there are two functions using fetch and promises. On submit, the eventhandler calls uploadImageFile(formObj) and fetchQR(formObj) sequentially. The problem is that, before the image name is returned from the first fetch, the QR code is being generated by the second fetch. Please note that the page currently displays a logo that is hard-coded for demonstration purposes.

I need the logo used in the QR to be supplied by the uploadImageFile function. I suppose if I code these as async functions, the second fetch to display the QR will only happen after the image name has been returned and saved in the shared object 'assocArray'. But I don't know how to do it.
Related categories: JavaScript HTML5 ECMAScript