troubleshooting Question

Javascript Variable Through Modal Window

Avatar of stkoontz
stkoontzFlag for United States of America asked on
JavaScriptPHP
22 Comments1 Solution906 ViewsLast Modified:
I'm trying to pass a javascript variable through a modal window.  I can get the variable into a text field, but can't figure out how to pass it to another page.  Here's the javascript...

<script type="text/javascript">
$(document).on("click", ".open-AddBookDialog", function (e) {

    e.preventDefault();

    var _self = $(this);

    var myBookId = _self.data('id');
    $("#bookId").val(myBookId);

    $(_self.attr('href')).modal('show');
});
</script>

Here's the code that triggers the javascript
<a data-id="<?php echo $id_family_member;?>" title="Add this item" class="open-AddBookDialog btn btn-primary" href="#addBookDialog">test</a>

Here's the input command that puts the javascript variable into the field.

<input type="text" name="bookId" id="bookId" value="" />

Any ideas on how to get a button or a link to pass the variable to a PHP page?

Thanks,

Steve
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 22 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 22 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros