Pass dynamic content to bootstrap modal 3.2

后端 未结 2 1204
猫巷女王i
猫巷女王i 2020-12-17 21:35

What i\'m trying to do is to pass the data-id value to an external link via JQuery ajax. The modal will show up but the data-id attribute is not sending to the external link

2条回答
  •  一整个雨季
    2020-12-17 22:15

    Dont mix onclick attributes with event handlers, its messy and can cause errors (such as mistaking the scope of this, which i believe is you main issue here).

    If you are using jquery make use of it: First add a class to the links you want to attach the event to, here i use the class showme:

    Show Me
    

    Then attach to the click event on those links:

    
    

    To access the variable in php:

    $uid = $_GET['id']; //NOT $_GET['uid'] as you mention in a comment
    

提交回复
热议问题