Home > Web Front-end > H5 Tutorial > body text

Detailed explanation of examples of page jumps and value transfer

Y2J
Release: 2017-05-20 13:42:39
Original
3651 people have browsed it

This article mainly introduces the Web front-end page to jump and get the value, that is, jump from page A to page B, and get the value of page B and assign it to page A for display. Please refer to the specific implementation method. Next article

Record it

(jump from page A to page B, and get the value of page B and assign it to page A for display)

Let’s give an example first A chestnut ;)

This is page A

This is page B

By clicking The added log on page A jumps to page B, and the log content added on page B is transferred to the red box position on page A

First quote js, I have one of my own that quotes openpage.js Plug-in

//这个是放在A页面上的 
//将填写的日志 返回的json数据  填充到客户详情
        function DunnAge(data) { //成功之后从B页面返回的数据data
            var data = JSON.parse(JSON.stringify(data));
            var Remark = data.Body.Remark;//内容
            var AddTimeStr = data.Body.AddTimeStr;
            var html = &#39;<p class="accessLog"><p class="val-log">&#39; + Remark + &#39;</p><p class="time-log">&#39; + AddTimeStr + &#39;</p></p>&#39;;
            $(".js_noJilu").hide();
            $(".js_rizhi").prepend(html)
        }
 <p class="detailss-btn js_openPage" data-url="/OACustomer/AddLogView?Id=@detail.Id">添加日志</p>
Copy after login

Configure the header in public js

(Detailed App header configuration instructions- ---------App configuration page header)

A页面的头部  "/OACustomer/CustomerDetail": { title: "客户详情", headLeft: [{ foreImage: "iconback", eventString: "gjj://Close.Page/1?jsCallBack=JC5wYWdpbmcuc2VhcmNoKCk7"}],
 headRight: [{ foreImage: "icondrop", type: "DropDownList", menus: [{ iconImage: "iconcontentchange", alpha: "100", text: "修改客户信息", textSize: 16, textColor: "000000", backColor: "FFFFFF", eventString: "modiFicaTion()" }, ], }] },
B页面的头部  "/OACustomer/AddLogView": { title: "添加客户日志", headRight: [{ text: "提交", eventString: "submit()" }] }//js里配置的头部
  //这是放在B页面上的
  //提交
        function submit() {
            var mes = $("form").validtor();
            if (mes) {
                $.dialog.openDialogString(mes);
                return false;
            }
            var url = "/OACustomer/SubmitAddLog";
            $.ajax({
                type: "post",
                url: url,
                data: $("form").serialize(),
                dataType: "json",
                beforeSend: function () {
                },
                error: function () {
                    $.dialog.openDialogString("加载失败,请重试");
                },
                success: function (data) {
                    if (data.DictJsonStatus == 200) {
                        //将填写的日志 返回的json数据  填充到客户详情
                        $.zProtocol({
                            type: "Close.Page",
                            path: "/1",
                            success: &#39;DunnAge(&#39; + JSON.stringify(data) + &#39;)&#39;
                        });
                    } else {
                        $.dialog.openDialogString(data.Msg);
                    }
                }
            })
        }
//页面内容
<form action="/OACustomer/SubmitAddLog">//后台提交数据的action(SubmitAddLog)
<!------action 提交地址------>
<input type="hidden" value="@detail.Id" name="FkOACustomer"/>
<p class="remarks">
<p><i style="color:#f00">*</i>备注留言:</p>
<p>
<textarea placeholder="请填写申请表述(必填)" class="js_inputbox" name="Remark" data-tipname="备注留言" data-valid=&#39;{required:true}&#39;></textarea></p>
</p>
</form>
Copy after login

After fetching the data, click Submit to close one page, page B, and return to the previous page, page A. Finally, the data was retrieved and displayed in the red box on page A.

【Related recommendations】

1. Html5 free video tutorial

2. Detailed explanation of how to handle IE8 incompatible rgba()

3. Detailed explanation of the code for phonegap to complete the contact search function

4. Detailed explanation of the code for phonegap to complete the cloning and deletion of contacts functions

5. phonegap listens for other events after the deviceready event is triggered

The above is the detailed content of Detailed explanation of examples of page jumps and value transfer. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template