odoo post template form using js code example

Example 1: odoo post template form using js

var image_input = null;var file = document.getElementById('photo').files[0];if (file) {     var reader = new FileReader();     reader.readAsDataURL(file);     reader.onload = function(e)          {             image_input = e.target.result;         }var result = {'article': image_input}$.ajax({        url: "/page/admission_details",        method: "POST",        dataType: "json",        data: result,

Example 2: odoo submit form using js and display data

success: function(data){    console.log(typeof data);    console.log('Success! ' + data);    var doc = new DOMParser().parseFromString(data, "text/html");    var tmp_element = doc.getElementById('form');    console.log('Element ' + tmp_element);    if (tmp_element == null){        document.getElementById('form_error').innerHTML = "The page needs to be reloaded!";    }else{        form.submit();    }    },

Tags:

Misc Example