function makeLink(){ let blob = new Blob(chunks, {type: media.type }) , Url = URL.createObjectURL(blob) , li = document.createElement('li') , mt = document.createElement(media.tag) , hf = document.createElement('a'); mt.controls = true; mt.src = Url; hf.href = Url; hf.download = `${counter++}${media.ext}`; hf.innerHTML = `donwload ${hf.download}`; let formData = new FormData(); formData.append(audio, blob, 'audio.wav'); let x='test' $.ajax({ type:'GET', url:'/answer/voice', data: formData, contentType: false, processData: false, success:function(result) { $("#chatbox").append('<p class ="userText"><audio style="background-color:white;" controls> <source src="' + Url+ '" type="audio/wav"></audio></p>'); $("#chatbox").append('<p class ="botText"><span>' + result.emotion+ '</span></p>'); $("#textInput").val("") }, error:function(result){ alert('sorry an error occured'); } });}