如下标红

<script>
      <%--测试juquery的代码如下操作。我们可以看出使用juquery
      进行选择标签的属性可以更加方便--%>
        console.log("测试juquery:"+$("#ti").text());


        //直接通过ajax也可以做数据的交互,只是在返回的数据中,必须是java的json格式的数据。不然会报错。
        function getRquerst(){
          data1 = {
            "name":"朋友你好!",
            "pwd":"adminadmin"
          };
          console.log("打印测试");
          $.ajax({
            //几个参数需要注意一下
            type: "POST",//方法类型
            //dataType: 'string',//预期服务器返回的数据类型
            url: "/NewProject_war_exploded/homepage" ,//url
            data: data1,
            success: function (result) {
              datas = JSON.parse(result);
              console.log(datas);//打印服务端返回的数据(调试用)
              location.href="/NewProject_war_exploded/register?"+"name=abc&pwd=123456";
              if (result.resultCode === 200) {
                alert("SUCCESS");
              }
            },
            error : function() {
              alert("异常!");
            }
          });
        }

    </script>

  

 

相关文章:

  • 2021-04-30
  • 2021-11-27
  • 2022-02-08
  • 2021-10-02
  • 2021-07-27
  • 2021-04-02
  • 2021-11-02
  • 2021-10-17
猜你喜欢
  • 2022-12-23
  • 2022-01-05
  • 2021-12-27
  • 2022-01-01
  • 2021-06-23
  • 2021-11-28
  • 2022-12-23
相关资源
相似解决方案