I'm trying to use load() to load two divs #follow-x
and #follow-y
ajaxly with a click of a button.This is what I have tried in success
function,but doesn't work,but works if I remove one of the function,so it loads only one div but I want it to load both.Thanks in advance
$('#follow').click(function(){
$.ajax({
type: "POST",
url: "{% url 'follow_class' %}",
data: {'pk': '{{class.pk}}' , 'csrfmiddlewaretoken': '{{ csrf_token }}'},
dataType: "json",
success: function(){
$('#follow-x').load("{% url 'class_details' %} #follow-x");}
function(){
$('#follow-y').load("{% url 'class_details' %} #follow-y");}
});
});
</script>
Dont mind the tags{}
I'm using Django