Cannot attach Dropzone to AJAX loaded DIV

I use Dropzone to handle client side image uploads. The following is a very basic example I have working:
http://www.dressorganic.co.uk/dropzone-test/noajax.htm

As you can see when you view source, I use JQuery to attach Dropzone to the upload1 div ID.

However in the following example I load the upload1 div using AJAX:
http://www.dressorganic.co.uk/dropzone-test/withajax.htm

Unfortunately I cannot get Dropzone to attach to the DIV. I am aware I can insert the JQuery within singleproductupload.asp which contains the HTML to be loaded. But I would prefer to have the JQuery in the parent page.
mike99cAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mukesh YadavFull Stack DeveloperCommented:
Replace old script this one
<script type="text/javascript">
//<![CDATA[
$(function() {

$("#upload1").dropzone({url: "/dropzone-test/handleupload.asp"});

$.ajax({
  type: 'POST',
  url: "/dropzone-test/singleproductload.asp",
  data: { ID: '1' },
  success: function(result) {
	$("#singleproductload").append(result);

  },
  error: function(XMLHttpRequest, textStatus, errorThrown) {
	 alert(textStatus + ": " + errorThrown);
  },
  
  async:true
});		

				
});  // JQuery
//]]>
</script>

Open in new window


With the below script on withAjax.htm

<script type="text/javascript">
//<![CDATA[
$(function() {
$.ajax({
  type: 'POST',
  url: "/dropzone-test/singleproductload.asp",
  data: { ID: '1' },
  success: function(result) {
	$("#singleproductload").append(result);
      $("#upload1").dropzone({url: "/dropzone-test/handleupload.asp"});
  },
  error: function(XMLHttpRequest, textStatus, errorThrown) {
	 alert(textStatus + ": " + errorThrown);
  },
  
  async:true
});		

				
});  // JQuery
//]]>
</script>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mike99cAuthor Commented:
Thanks a lot Muskesh, that did the trick:

I have modified the code and appied it here:
http://www.dressorganic.co.uk/dropzone-test/withajax-solution.htm
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.