如何从打开引导模式的按钮中提取多个变量的数据?

时间:2016-07-05 15:06:10

标签: javascript jquery

由于某种原因,my-link2和mylink3没有提取任何数据。他们显示未定义。所以我不确定我做错了什么?

按钮:

    <input class='btn btn-default' 
    data-mylink=\"$row[auditID]\"
    data-mylink2=\"$audit_type\"
    data-mylink3=\"$row[audit_instanceID]\"
    type=button 
    data-toggle='modal' 
    data-target='#perform_audit'
    value='Take Audit' />

Jquery的:

$('#perform_audit').on('shown.bs.modal', function (e) {
        var btn = $(e.relatedTarget);
        var auditID = btn.data('mylink');
        var audittype = btn.data('mylink2');
        var auditinstanceID = btn.data('mylink3');

        $('#editfindings_audit1').text(auditID); 
        $('#editfindings_audit1').text(audittype);
        $('#editfindings_audit1').text(auditinstanceID);

        alert(auditID + " : "+audittype+ " : " + audittype);
        $('#editfindings_audit1').load("answer_audit.php?auditID="+auditID+"&audit_type="+audittype+"&action=answer&audit_instanceID="+auditinstanceID);
        //answer_audit.php?auditID=214&action=answer&audit_instanceID=572   
        //alert(auditID +" 0"+ audittype +" 0" +auditinstanceID); 
        //window.open("answer_audit.php?auditID="+auditID+"&audit_type="+audittype+"&action=answer&audit_instanceID="+auditinstanceID)
});//End [Take Audit] button

1 个答案:

答案 0 :(得分:0)

我认为您应该使用.data()代替$('#perform_audit').on('shown.bs.modal', function (e) { var btn = $(e.relatedTarget); var auditID = btn.attr('data-mylink'); var audittype = btn.attr('data-mylink2'); var auditinstanceID = btn.attr('data-mylink3'); $('#editfindings_audit1').text(auditID); $('#editfindings_audit1').text(audittype); $('#editfindings_audit1').text(auditinstanceID); alert(auditID + " : "+audittype+ " : " + audittype); $('#editfindings_audit1').load("answer_audit.php?auditID="+auditID+"&audit_type="+audittype+"&action=answer&audit_instanceID="+auditinstanceID); //answer_audit.php?auditID=214&action=answer&audit_instanceID=572 //alert(auditID +" 0"+ audittype +" 0" +auditinstanceID); //window.open("answer_audit.php?auditID="+auditID+"&audit_type="+audittype+"&action=answer&audit_instanceID="+auditinstanceID) });//End [Take Audit] button 。试试这个:

        /systemr/port/AIX/comp/oraxlc.shx -F/systemr/port/AIX/comp/xlc.cfg -I/usr/lib/R/include -DNDEBUG  -I/systemr/port/AIX/include -I/opt/freeware/include -I/usr/linux/include -I/usr/local/include -I/usr/lpp/X11/include/X11 -I/systemr/port/AIX/include/cairo -I/systemr/port/AIX/lib/pixman      -O -qstrict -qnoldbl128  -c chron_strs.c -o chron_strs.o
/systemr/port/AIX/comp/oraxlc.shx: not found

make: The error code from the last command is 1.


Stop.
ERROR: compilation failed for package 'chron'
* removing '/usr/lib/R/library/chron'
During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_TIME failed, using "C"
3: Setting LC_MESSAGES failed, using "C"
4: Setting LC_MONETARY failed, using "C"
ERROR: dependency 'chron' is not available for package 'data.table'
* removing '/usr/lib/R/library/data.table'

The downloaded source packages are in
        '/tmp/RtmpfuNMaa/downloaded_packages'
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning messages:
1: In doTryCatch(return(expr), name, parentenv, handler) :
  unable to load shared object '/usr/lib/R/modules//R_X11.so':
  Could not load module /usr/lib/libX11.a(shr_64.o).
        Dependent module libiconv.a(shr4_64.o) could not be loaded.
        Member shr4_64.o is not found in archive
Could not load module /usr/lib/R/modules//R_X11.so.
        Dependent module /usr/lib/libX11.a(shr_64.o) could not be loaded.
2: In install.packages("data.table") :
  installation of package 'chron' had non-zero exit status
3: In install.packages("data.table") :
  installation of package 'data.table' had non-zero exit status