Show PHP object data inside javascript -


i know there have been many questions far asking php , js working together...i went through them, cannot find elegant solution use case.

what have following php code in webpage fetches product info , shows it:

<?php   $p= new product($prodid);   $p->getproductinfo();    //now show product info...   echo "<div>product name: ".$p['productname']."</div>";   echo "<div>product rating: ".$p['productrating']."</div>";   //etc... ?> 

now have been asked instead of showing data directly in page, should show when button clicked. , should show inside bootbox modal dialog box

so did:

<span id='prod-details'> view product details </span> <input type='hidden' id ='prod-id' value='<?php echo $p['productid'];?>'> 

and in jquery file have:

$('#prod-details').click(function(    var prodid = $('#prod-id').val();    productdetail = "product details "+prodid;     //how rest of product details php object?     bootbox.alert(productdetail); )); 

any appreciated...i have been trying hard make work.

what echo information inside bootbox modal div , hide/show bootbox modal div onclick function


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -