jquery Ajax 帖子以获取 pdf 文件不起作用检查与火虫没有帖子发生



我想将 ajax post 请求发送到 jsp 页面,该页面在接收参数时将 para 嵌入其中并发回我打算在div 中显示的 pdf 在检查火虫时,我注意到没有发生 ajax 帖子。

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
    <script type="text/javascript">
    $(document).ready(function() {
        $("#click").click(function() 
        {
        name = $("#name").val();
            age = $("#age").val();
            $.ajax({
                    type : "POST",                              
                url : "Test.jsp",                                         
                    data : "name=" + name + "&age=" + age,                                  
                    success : function(data) {                                              
                    $("#pdf").html(data);                                                 
                    } });                                                                            
                   });
                   });
         </script>
         </head>
         <body>
         <input type="text" id="name" name="name" >
         <br />
    <br /> Age :
    <input type="text" id="age" name="age">
    <br />
    <br />
    <button id="click">Click Me</button>
    <div id="pdfenter code here"></div>
</body>
</html>

尝试像这样传递数据:

data : {'name': name, 'age': age},

编辑:

同时关闭您的脚本标签:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" >
----------------------------------------------------------------------- here -^

成为:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" />

最新更新