不想多说, 一劳永逸吧
@Configuration
public class CORSConfiguration {
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedHeaders("*")
.allowedMethods("*")
.allowedOrigins("*");
}
};
}
}
var url = "http://112.74.171.99:8080/autoticketapi/pay";
$.ajax({
crossDomain : true,
url: url,
type: "GET",
data: {"liantuoOrderNo": $(this).attr("liantuoOrderNo"), "orderNo": $(this).attr("orderNo")},
dataType: "json",
success: function (data) {
if (data.status != 200) {
alert("自动出票错误,请联系技术")
} else {
alert(data.msg)
}
}
});
网友评论