zoukankan      html  css  js  c++  java
  • $.param()的实例应用

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Document</title>
    </head>
    <body>

    <pre>
    var jumpUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize?'
    var params = {
    appid: 'ssssss', // 公众号appid
    redirect_uri: 'http://woejfoa.com/a/s.html', //回调地址,域名配置同一地址 定位到目录
    response_type: 'code',
    scope: 'snsapi_userinfo',// 需要用户确认登录
    state: 'STATE'
    }
    jumpUrl += $.param(params) + '#wechat_redirect';
    console.log(jumpUrl);
    jQuery.param()函数用于将一个JS数组或纯粹的对象序列化为字符串值,以便用于URL查询字符串或AJAX请求。

    </pre>


    <script src="js/jquery.min.js"></script>
    <script>

    var jumpUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize?'
    var params = {
    appid: 'ssssss', // 公众号appid
    redirect_uri: 'http://woejfoa.com/a/s.html', //回调地址,域名配置同一地址 定位到目录
    response_type: 'code',
    scope: 'snsapi_userinfo',// 需要用户确认登录
    state: 'STATE'
    }
    jumpUrl += $.param(params) + '#wechat_redirect';
    // location.href = jumpUrl // 获取code跳转到回调地址
    console.log(jumpUrl);
    // jQuery.param()函数用于将一个JS数组或纯粹的对象序列化为字符串值,以便用于URL查询字符串或AJAX请求。
    /* https://open.weixin.qq.com/connect/oauth2/authorize?appid=ssssss&redirect_u….html&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect*/
    </script>
    </body>
    </html>

  • 相关阅读:
    给定一个排序数组,你需要在原地删除重复出现的元素
    OSPF-外部路由
    虚链路
    OSPF域间路由计算,防环
    转 C# 只允许运行一个实例
    转 点击关闭时最小化到任务栏
    C#,int转成string,string转成int
    SQL 查找表名 字段名
    C# *= 运算顺序
    SQL 批量删除表
  • 原文地址:https://www.cnblogs.com/studyh5/p/7753684.html
Copyright © 2011-2022 走看看