I am sending encoded HTML to my python ajax handler by jQuery. Here is my jQuery code:
var animal_data = encodeURI( $('#animal-list-table').html() ); // something like this: %0A%20%20%20%20%20%20%20%20
mydata = 'action=send_mail&animal_data='+animal_data
$.ajax({
type: 'POST',
url: '/customer/templates/slakteweb/ajax-handler',
data: mydata,
processData: false,
success: function(result){
console.log(result);
}
});
In the ajax handler, I have tried like this:
import urllib
animal_data = site.param('animal_data')
animal_data_html = urllib.unquote(animal_data).decode('utf8')
But I wanted to print the HTML tags and everything so that I can send it as HTML email. What is the best way to do that?