Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
deleted 10 characters in body
Source Link
Rory McCrossan
  • 337.9k
  • 41
  • 322
  • 353

Jquery need Need to set a var into a link

iI have this loop where i'mI'm creating a link  , but bootstrap modals prevents me to use php varsPHP variables properly from the top loop.  (Yes a loop in loop).So i So I decided to use jqueryjQuery and get the id from the button when isit's clicked, and that is fine, butbut how todo I append this into the link without appending the whole link  , because there is another ID variable which imI'm using again in this links  ? Here in $value->getId() i$value->getId() I need to append value from JqueryjQuery.

 foreach ($exploredArtistBands as $band) {   echo '<a href="/notification/invite/' . $value->getId() . '/' . $band['band_id'] . '">Join to ' . $band['name'] . '</a><br />';  }    $('.invite').click(function(){ $(this).attr('button-id') }); 
$('.invite').click(function(){ $(this).attr('button-id') }); 

Jquery need to set a var into a link

i have this loop where i'm creating a link  , but bootstrap modals prevents me to use php vars properly from the top loop.(Yes loop in loop).So i decided to use jquery and get the id from the button when is clicked, and that is fine, but how to append this into the link without appending the whole link  , because there is another ID variable which im using again in this links  ? Here in $value->getId() i need to append value from Jquery.

 foreach ($exploredArtistBands as $band) {   echo '<a href="/notification/invite/' . $value->getId() . '/' . $band['band_id'] . '">Join to ' . $band['name'] . '</a><br />';  }    $('.invite').click(function(){ $(this).attr('button-id') }); 

Need to set a var into a link

I have this loop where I'm creating a link, but bootstrap modals prevents me to use PHP variables properly from the top loop  (Yes a loop in loop). So I decided to use jQuery and get the id from the button when it's clicked, and that is fine, but how do I append this into the link without appending the whole link, because there is another ID variable which I'm using again in this links? Here in $value->getId() I need to append value from jQuery.

foreach ($exploredArtistBands as $band) { echo '<a href="/notification/invite/' . $value->getId() . '/' . $band['band_id'] . '">Join to ' . $band['name'] . '</a><br />'; } 
$('.invite').click(function(){ $(this).attr('button-id') }); 
Source Link

Jquery need to set a var into a link

i have this loop where i'm creating a link , but bootstrap modals prevents me to use php vars properly from the top loop.(Yes loop in loop).So i decided to use jquery and get the id from the button when is clicked, and that is fine, but how to append this into the link without appending the whole link , because there is another ID variable which im using again in this links ? Here in $value->getId() i need to append value from Jquery.

 foreach ($exploredArtistBands as $band) { echo '<a href="/notification/invite/' . $value->getId() . '/' . $band['band_id'] . '">Join to ' . $band['name'] . '</a><br />'; } $('.invite').click(function(){ $(this).attr('button-id') });