JS/JQUERY(5)——Jquery前后台交互
结局jquery.getJson 传递参数 转义的问题
function testget(){ $.ajax({ async:true, cache:false,//默认是true 使用缓存 success:function(result){ alert(result); }, type:"get", data:"uname=zhangsan&realname="+encodeURIComponent("张三三"), url:"HelloServlet" }); } function testpost(){ $.ajax({ async:true, cache:false, success:function(result){ alert(result) }, type:"post", data:"uname=zhangsan&realname="+encodeURIComponent("张三三"), url:"HelloServlet" }); } function testGet(){ $.get("HelloServlet","uname=zhangsan&realname="+encodeRUIComponent("张三三")+"&random="+Math.random(),function(result){ alert(result); }); } function testPost(){ $.post("HelloServlet","uname=zhangsan&realname=张三三",function(result){ alert(result); }); }

浙公网安备 33010602011771号