Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 后端只调用一次_Javascript_Jquery_Internet Explorer_Spring Mvc_Freemarker - Fatal编程技术网

Javascript 后端只调用一次

Javascript 后端只调用一次,javascript,jquery,internet-explorer,spring-mvc,freemarker,Javascript,Jquery,Internet Explorer,Spring Mvc,Freemarker,我正在开发一个基于SpringMVC的web应用程序。 我使用Freemarker和JQuery。 @Freemarker,我有以下JQuery,它应该到后端两次: $(document).ready(function() { var date = new Date(); var d = date.getDate(); var m = date.getMonth(); var y = date.getFullYear(); $.getJSON('[@sp

我正在开发一个基于SpringMVC的web应用程序。 我使用Freemarker和JQuery。 @Freemarker,我有以下JQuery,它应该到后端两次:

 $(document).ready(function() {
    var date = new Date();
    var d = date.getDate();
    var m = date.getMonth();
    var y = date.getFullYear();
    $.getJSON('[@spring.url '/vacation/loadResourceVacation'/]', function (data) {
      $.getJSON('[@spring.url '/vacation/loadPublicVacations'/]', function (returnedPublicVacation) {....
这两种java方法是:

 @RequestMapping(value = "/loadResourceVacation", method = RequestMethod.GET)
  public
  @ResponseBody
  String loadResourceVacation(HttpServletResponse response) throws Exception {

    // Convert to JSON string.
    String json = new Gson().toJson(myObject);

    // Write JSON string.
    response.setContentType("application/json");
    response.setCharacterEncoding("UTF-8");

    return json;
  }


@RequestMapping(value = "/loadPublicVacations", method = RequestMethod.GET)
  public
  @ResponseBody
  String loadPublicVacations(HttpServletResponse response) throws Exception {

    // Convert to JSON string.
    String json = new Gson().toJson(someObj);

    // Write JSON string.
    response.setContentType("application/json");
    response.setCharacterEncoding("UTF-8");

    return json;
  }
@谷歌Chrom,它工作得非常好。 然而@IE,它在我第一次加载页面时运行良好。 如果我再次尝试加载页面,这两个方法将不会被调用,并且它将从第一次开始被缓存

如果我关闭会话并打开一个新会话,那么这两个方法将再次被调用。 任何帮助

报告说:

缓存布尔

默认值:数据类型“script”和“jsonp”为true、false

如果设置为false,它将强制浏览器不缓存请求的页面。将cache设置为false还会将查询字符串参数“=[TIMESTAMP]”附加到URL

确切地ajaxSetup({cache:false});