0

我有一个按钮,就像

 <button class="cart" onclick="allow(this)" data-val="134" data-pcode="sdfghj">
                           car</button>

功能allow是:

function allow(value)
{
    console.log(value);
    $.mobile.changePage('allow.html', {
      type: "get",
      data: {
            value:value
        },
      transition: "slideup", 
      changeHash: true
    });
}

对于接收和allow.html页面,我正在使用

$(document).on( "pageinit", "#viewandgift", function( e ) {
    console.log("page loaded view and gift wala");
    var passedId = (($(this).data("url").indexOf("?") > 0) ? $(this).data("url") : window.location.href ).replace( /.*value=/, "" );
    $("#details").html(["Selected id is: '", passedId, "'"].join(""));
    console.log("--------------------------");
    console.log(passedId);
});

在第二页提取价值的正确方法是什么?解析 URL 不是一个好的选择。

4

0 回答 0