fixing performance plot
This commit is contained in:
@@ -11,52 +11,53 @@
|
||||
<script>
|
||||
|
||||
function submit_form() {
|
||||
console.log("form changed");
|
||||
var frm = $("#performanceform");
|
||||
|
||||
var data = new FormData(frm[0]);
|
||||
|
||||
$.ajax({
|
||||
url:"/rowers/performancemanager/user/{{ rower.user.id }}/",
|
||||
type: "POST",
|
||||
contentType: false,
|
||||
processData: false,
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
// var parsedJSON = $.parseJSON(data); //
|
||||
$("#id_script").replaceWith('<div id="id_script">'+data.script+'</d'+'iv>');
|
||||
$("#id_chart").replaceWith('<div id="id_chart">'+data.div+'</d'+'iv>');
|
||||
$("#endfitness").html(data.endfitness)
|
||||
$("#endfatigue").html(data.endfatigue)
|
||||
$("#endform").html(data.endform)
|
||||
console.log('done');
|
||||
}
|
||||
});
|
||||
};
|
||||
console.log("form changed");
|
||||
var frm = $("#performanceform");
|
||||
|
||||
var data = new FormData(frm[0]);
|
||||
|
||||
$.ajax({
|
||||
url:"/rowers/performancemanager/user/{{ rower.user.id }}/",
|
||||
type: "POST",
|
||||
contentType: false,
|
||||
processData: false,
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
|
||||
success: function(data) {
|
||||
console.log(data.div);
|
||||
|
||||
// var parsedJSON = $.parseJSON(data); //
|
||||
$("#id_script").replaceWith('<div id="id_script">'+data.script+'</d'+'iv>');
|
||||
$("#id_chart").replaceWith('<div id="id_chart">'+data.div+'</d'+'iv>');
|
||||
$("#endfitness").html(data.endfitness)
|
||||
$("#endfatigue").html(data.endfatigue)
|
||||
$("#endform").html(data.endform)
|
||||
console.log('done');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val();
|
||||
console.log("CSRF token",csrftoken);
|
||||
|
||||
function csrfSafeMethod(method) {
|
||||
// these HTTP methods do not require CSRF protection
|
||||
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
|
||||
}
|
||||
$.ajaxSetup({
|
||||
beforeSend: function(xhr, settings) {
|
||||
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
|
||||
xhr.setRequestHeader("X-CSRFToken", csrftoken);
|
||||
}
|
||||
}
|
||||
var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val();
|
||||
console.log("CSRF token",csrftoken);
|
||||
|
||||
function csrfSafeMethod(method) {
|
||||
// these HTTP methods do not require CSRF protection
|
||||
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
|
||||
}
|
||||
$.ajaxSetup({
|
||||
beforeSend: function(xhr, settings) {
|
||||
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
|
||||
xhr.setRequestHeader("X-CSRFToken", csrftoken);
|
||||
}
|
||||
}
|
||||
});
|
||||
$("#performanceform").on('change', function(evt) {
|
||||
submit_form();
|
||||
});
|
||||
});
|
||||
$("#performanceform").on('change', function(evt) {
|
||||
submit_form();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user