Files
PyRIGS/assets/static/js/ajax_form.js
Matthew Smith 207bf7bd7a Added dependency django-polymorphic
Model change to take advantage of said polymorphism
Implemented asset search
2019-10-02 21:12:24 +01:00

41 lines
1.0 KiB
JavaScript

function formAssetSearch() {
$.ajax({
url : "/asset/filter/", // the endpoint
type : "POST", // http method
data : {
sender: 'asset_update',
form: "csrfmiddlewaretoken=" + $('input[name=csrfmiddlewaretoken]').val() + "&asset_id=" + $('#parent_search').val()
},
traditional: true,
success : function(data) {
// console.log(data);
$('#formAssetSearchResult').html(data);
// window.location.href = data['url'];
},
error : function(xhr) {console.log(xhr.status + ": " + xhr.responseText)}
});
}
function deleteAsset(asset_id) {
$.ajax({
url : "/asset/delete/", // the endpoint
type : "POST", // http method
data : {
asset_id: asset_id
},
traditional: true,
success : function(data) {
// console.log(data);
window.location.href = data['url'];
},
error : function(xhr) {console.log(xhr.status + ": " + xhr.responseText)}
});
}