Skip to content
Snippets Groups Projects
Commit 6ac5e59a authored by Byron Biggs's avatar Byron Biggs
Browse files

Revert "Updates API call points"

This reverts commit 65cbd9b7
parent 13b55c69
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ public class SurveyController {
return "results"; // Returns the Thymeleaf results page
}
@CrossOrigin(origins = "http://localhost:3000") // Or your frontend URL
@PostMapping("/api/survey/submit")
@ResponseBody
public ResponseEntity<String> submitSurvey(@RequestBody SurveyData surveyData) {
......@@ -43,6 +44,7 @@ public class SurveyController {
}
// New endpoint to fetch survey results
@CrossOrigin(origins = "http://localhost:3000") // Allow cross-origin requests
@GetMapping("/api/survey/results")
@ResponseBody
public ResponseEntity<List<SurveyResultDTO>> getSurveyResults() {
......
......@@ -251,9 +251,9 @@ function submitSurvey() {
console.log('Survey Submitted:', surveyResponses); // Debugging Log (Replace with database sender)
// Send the AJAX request with dynamic URL
// Send the AJAX request
$.ajax({
url: window.location.origin + "/api/survey/submit",
url: "http://localhost:8080/api/survey/submit",
type: "POST",
contentType: "application/json", // Ensures the content type is set to JSON
data: JSON.stringify({responses: surveyResponses}), // Convert the data into a JSON string
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment