Last active
February 10, 2025 17:29
-
-
Save hjblok/5625761 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var formElement = document.getElementById("cart-form"); | |
var formAction = "/cart"; | |
var formMethod = "POST"; | |
var formData = new FormData(formElement); | |
var file = load_your_file_here; | |
formData.append('properties[file]', file); | |
var xhr = new XMLHttpRequest(); | |
xhr.open(formMethod, formAction); | |
//xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); | |
xhr.send(formData); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment