[Answer]-Returning ajax response from django

1👍

I don’t think a solution needs to be very convoluted to achieve the outcome you’re going for. Consider something on the lines of:

A page that looks like:

<a class="btn" onclick="doexchange">render</a>

An JavaScript that looks like the following:

function doexchange(){
    var dataBuffer = myCollecter(dataBuffer);

    $.get('/myurl/', {serializedData: JSON.stringify(dataBuffer)}, function(data) {
        alert('yes' + data);
    });
}

0👍

Try binding to the form submit in your javascript.

$('#form1').bind('submit', function( e ){
  e.preventDefault();
  var form=$(this),
    input=form.find('input[name="serializedData"]');
  $.ajax({
   //
  });

Leave a comment