This code sends a POST request to the URL 'http://127.0.0.1:9999/getAudio' and expects a JSON response. If the request is successful, it will set the innerHTML of the form with the ID 'result2' to the value of the key 'Rescoring_result' in the response. If there is an error, it will log the error to the console. However, there seems to be a syntax error with the backslashes () at the end of each line, which should be removed.

fetch('http://127.0.0.1:9999/getAudio', {method: 'POST'})
  .then(response => JSON.parse(response))
  .then(response => document.getElementById('result2').innerHTML = response['Rescoring_result'])
  .catch(error => console.error(error))

This corrected code will work as intended, sending the request and displaying the desired data.

Sending POST Request to Get Audio Data and Display Results

原文地址: https://www.cveoy.top/t/topic/lBlw 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录