gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
generate a html page with one input box and submit button when button clicked send text…
- User
generate a html page with one input box and submit button when button clicked send text to api address xxx then render api response
- Assistant
<div id="response"></div> <script> function submitForm(event) { event.preventDefault(); // Prevent form submission var text = document.getElementById("textInput").value; // Send AJAX request to the API var xhr = new XMLHttpRequest(); xhr.open("POST", "http://xxx/api/endpoint", true); xhr.setRequestHeader("Content-type", "application/json"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { var response = JSON.parse(xhr.responseText); document.getElementById("response").innerHTML = response.message; } }; var data = JSON.stringify({ "text": text }); xhr.send(data); } </script> - User
generate a html page with one input box and submit button when button clicked send text to api address xxx using post and send json body then render api response
- Assistant
<div id="response"></div> <script> function submitForm(event) { event.preventDefault(); // Prevent form submission var text = document.getElementById("textInput").value; // Send AJAX request to the API var xhr = new XMLHttpRequest(); xhr.open("POST", "http://xxx/api/endpoint", true); xhr.setRequestHeader("Content-type", "application/json"); xhr.onreadystatechange = function() { if (xhr.readyState === 4 && xhr.status === 200) { var response = JSON.parse(xhr.responseText); document.getElementById("response").innerHTML = response.message; } }; var data = JSON.stringify({ "text": text }); xhr.send(data); } </script>