日期:2014-05-17  浏览次数:20629 次

jsp页面提交action问题 求大神解
<script type="text/javascript">
function a(){
var type=$("#type").val();
var title=$("#title").val();
var content=$("#content").val();
$.post("saveArtiles.action",{"articles.type":type,
                                "articles.title":title,
                                "articles.content":content},function(data){
                   location.href="findAllArt.action";
                    })
}
</script>
  </head>
  
  <body>
    <table>
     <tr>
     <td>标题:</td>
     <td><input id="title"/></td>
     </tr>
     <tr>
     <td>内容:</td>
     <td><input id="content"/></td>
     </tr>
     <tr>
     <td>类型:</td>
     <td><input id="type"/></td>
     </tr>
     <tr>
     <td><input type="button" onclick="a()"/></td>
     </tr>
    </table>
  </body>



上面是我的页面代码   只要文本框里面没有值它就能成功得跳action 但是一有值就不行了  求解是为什么啊

------解决方案--------------------
关键是报什么错呢?
js代码没看到什么问题
加上type="text"试下。


<script type="text/javascript">
function a(){
var type=$("#type").val();
var title=$("#title").val();
var content=$("#content").val();
$.post("saveArtiles.action",{"articles.type":type,
                                "articles.title":title,
                                "articles.content":content},function(data){
                   location.href="findAllArt.action";
                    })
}
</script>
  </head>
  
  <body>