Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("#floorplan-post").submit(function (event) {
- //handles the post for the floorplan
- event.preventDefault();
- var eventId = $("#hidden_id").attr('name');
- var formData = new FormData();
- var img = $('#validatedCustomFile')[0].files[0];
- formData.append('img',img);
- //sends out into a token before the ajax request
- $.ajaxSetup({
- beforeSend: function(xhr, settings) {
- xhr.setRequestHeader("X-CSRFToken", '{{ csrf_token }}');
- console.log("Sent csrf");
- }
- });
- $.ajax({
- url: "{% url 'events:load_floorplan' %}",
- method:'POST',
- processData: false,
- data: formData,
- success: function(response){
- console.log("finshed");
- },
- error:function(data, textStatus, errorThrown){
- console.log("failed server side", errorThrown);
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement