2013-06-05 63 views
0

jQuery的Ajax請求jQuery的Ajax請求的錯誤

<script> 




function onSubModulesSelect(id, checkbox) { 
    alert(id) 
     if (checkbox.checked) { 
      $.ajax({ 
       type : 'POST', 
       url : 'selectedSubModulesRow.html', 
       data : ({ 
        checkBoxId : id 
       }) 
      }); 
     } 
    } 

    </script>\\\ 

控制器

@RequestMapping(value =Array("/selectedSubModulesRow.html")) 
    @ResponseBody 
    def selectedSubModuleRow(@RequestParam checkBoxId: String) { 
    println("Reached..!") 
    if (checkBoxId != null) { 

      println(checkBoxId) 

     } 
    } 

當我按下提交按鈕它不能解析到控制器的方法...瀏覽器控制檯顯示一些錯誤

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/resources/demos/style.css 
GET http://localhost:8080/learnware/teacher/selectedSubModulesRow.html?checkBoxId=q1 500 (Internal Server Error) jquery-1.9.1.js:8526 

回答

0

在對調度的配置確保你映射了靜態資源:

<!-- Handles HTTP GET requests for /resources/** by efficiently serving 
up static resources in the ${webappRoot}/resources directory --> 
<mvc:resources location="/resources/" mapping="/resources/**" /> 

這將導致調度servlet來忽略resources目錄中的任何要求,所有靜態的內容,如JS,CSS和圖像應放置。

+0

是否還有其他問題? –

+0

@jijeshAj我真的認爲你需要添加資源配置,如果你還沒有它。 –

+0

thnx凱文,但我怎麼可以添加.. –