douxianji6181 2017-09-05 12:16
浏览 149
已采纳

如何在Div按钮中传递ID,它在ajax中必须将Id传递给另一个页面?

below code is in my ajax which I have comment.id which is coming from php as unique id

 html += '<div class="rTableRow1"><div class="rTableHead"><input id="button1" type="button"   value="action !" />' + comment.id +'</div></div>'

As above full data which be shows a table

I require to click action button where it well take to another page with ID

any one have any idea have to pass a ID in Action button which is in my Ajax.

  • 写回答

1条回答 默认 最新

  • douxian4323 2017-09-05 13:01
    关注

    You can add onclick event-attribute to button as below:

    html += '<div class="rTableRow1"><div class="rTableHead"><input id="button1" type="button" value="action !" onclick="location.href = \'http:\\www.yoursite.com'+comment.id+'\'" />' + comment.id +'</div></div>'

    Here, http:\\www.yoursite.com\ can be your URL and append comment.id as you need to pass with URL to redirect.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题