This file contains 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
// uses jquery | |
$.ajax({ | |
type: "POST", | |
url: "{% url 'attachment-object-coupling' project.slug %}", | |
data: { | |
attachment: attachments.attr("id"), // attachment instance_id | |
object: objects.attr("id"), // object instance_id | |
csrfmiddlewaretoken: '{{ csrf_token }}' // if not configured to include token in every post | |
}, | |
success: function(data) { | |
updateDOM(data); // define elsewhere | |
}, | |
error: function(jqXHR, textStatus, errorThrown) { | |
alert("Error, status = " + textStatus + ", " + | |
"error thrown: " + errorThrown | |
); | |
} | |
}); |