I have a form that displays 'item' properties. The user has the option of uploading files/attachments to this 'item'. Currently, in a div with class 'testing' displays the existing attachments for the item. The user uses an 'attach' button to attach files to the item they want to update. The files are never actually attached until the form is submitted with an 'update' button click event (which is what I want). The form submit is an ajax submit to an iframe. I want to use jquery to load a coldfusion page containing the query for finding currently attached items into my 'testing' div. My initial approach was to use jquery's load function after the form submit:
//In the JS file, the selected item is used in the CF query form.submit(); $('.testing').load('itemAttachments.cfm?itemID=' + selectedItem); I know my coldufusion query works, because it is a cfinclude in the 'testing' div and the page initially loads with the correct information. On the form submit, the jquery load returns the cf page, but with the same data and not the new attachments listed. When I refresh the page, the data is displayed correctly (i.e. with the new attachments listed). This leads me to believe that everything works right, but the jquery load is happening before the Oracle can process the query.
Is this correct? If so, how can I fix this? Thanks.
EDIT The form submits to a target with a hidden iframe.The issue is that both the form submit and the jquery .load() are using the same page, itemAttachments. But the jquery load() is getting the results first, before the form submit, even though the .load is after the form submit in the code.