Ajax cannot get the value of controller

problem description

background written by others, I didn"t write the interface before I wrote the interface myself and then called it with ajax to get no data. I don"t know what went wrong. I don"t know exactly where to put the js and html files

the environmental background of the problems and what methods you have tried

related codes

/ / Please paste the code text below (do not replace the code with pictures)
this is controller

@Controller
@RequestMapping("/some")
public class SomeTestController {

@RequestMapping(value ="/test" )
@ResponseBody
public String getAirportList(HttpServletRequest request) {
    JSONObject json = new JSONObject();
    json.put("name", "jack");
    
    
    return json.toJSONString();
}
}

this is ajax

 $.ajax({
type:"post",
url:"/some/test",

dataType:"json",
success:function (data) {
    alert(data);
},
error:function () {
    alert("error");
}
})

what result do you expect? What is the error message actually seen?

then opening the web page will only pop up error


I haven't touched java for a long time.
@ ResponseBody in spring means that the result is converted to json, so you can just return the data here.
if the controller is used only as an interface, you can use @ RestController so that you don't have to write @ ResponseBody for every method.

I don't see anything wrong with Ali. If you can provide the corresponding network request in chrom F12 newWork, you can probably see the problem.

and the callback function of ajax err here can print out the eror instead of just an alert (error), so that it is impossible to view the problem
error. The callback function has input parameters, and it will tell you what went wrong.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b36cc8-343f1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b36cc8-343f1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?