Versies vergeleken

Uitleg

  • Deze regel is toegevoegd.
  • Deze regel is verwijderd.
  • Opmaak is veranderd.

...

Code Block
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
var fd = new FormData();    
fd.append( 'file', input.files[0] );

jQuery.ajax({
  url: 'http://example.com/script.php',
  type: 'POST',
  data: fd,
  processData: false,
  contentType: false,
  async: false,
  success: function(response){
    alert(response);
  }
});
</script>


Example 2) Call a URL, and use its Json object

Code Block
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
var fd = new FormData();    
fd.append( 'file', input.files[0] );

jQuery.ajax({
  url: 'http://example.com/script.php',
  type: 'POST',
  data: fd,
  processData: false,
  contentType: false,
  async: false,
  success: function(response){
    var obj=JSON.parse(response);
	alert( obj.result[0].message);
  }
});
</script>