aveeva Posted June 12, 2019 Share Posted June 12, 2019 (edited) My index.php, $output .= ' <div class="col-sm-3 col-lg-4 col-md-3"> <div style="border:1px solid #ccc; border-radius:5px; padding:10px; margin-bottom:16px; height:300px;"> <audio controls controlsList="nodownload" style="padding: 10px 10px 10px 10px;margin-left: -21px;"> <source src="audio_sample/'. $row['voice_audio_file'] .'" alt="" class="img-responsive"> </audio> <p align="center"><strong> '. $row['voice_name'] .'</strong></p> <p style="font-size: 12px;"> Id : '. $row['voice_id'].' <br /> Name : '. $row['voice_name'].' <br /> Gender : '. $row['voice_gender'].' <br /> Genres : '. $row['voice_genres'].' <br /> Voice Modulation : '. $row['voice_voice_modulation'].' <br /> Languages : '. $row['voice_languages'].' <br /> Jingle Moods : '. $row['voice_jingle_moods'].' <br /> Ivr : '. $row['voice_ivr'].' <br /> </p> <button type="button" class="btn btn-primary" type="submit" onclick="addCart('. "'".$row["voice_id"]."'".','."'". $row["voice_name"]."'".');" style="padding: 5px 83px 5px 83px;">Add to PlayList </button> same page ajax : <script> function addCart(voice_id, voice_name) { $.ajax({ type: 'POST', url: 'cart.php', data: { voice_id : voice_id, voice_name : voice_name }, dataType: 'text', success: function(data) { // alert(data); } }); } $(document).ready(function(){ }); </script> and get.php <?php $voice_id =" "; $voice_name=" "; if(isset($_POST['voice_id']) && isset($_POST['voice_name'])) { $voice_id = $_POST['voice_id']; $voice_name = $_POST['voice_name']; } echo "$voice_id, . "&". , $voice_name"; ?> if click button, the value send but the get.php not properly get the value and display on the php page. Edited June 12, 2019 by aveeva Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted June 12, 2019 Share Posted June 12, 2019 First of all, not really sure what this line is all about. echo "$voice_id, . "&". , $voice_name"; I see your "alert" test in your jQuery ajax success. That is good, but do more. Did you use Chrome's console inspector (or similar other browsers) to ensure the browser client is sending data? Next, be really simple at the server and just use exit('<pre>'.print_r($_POST).'</pre>'); or var_dump($_POST);. Quote Link to comment Share on other sites More sharing options...
Barand Posted June 12, 2019 Share Posted June 12, 2019 45 minutes ago, aveeva said: if click button, the value send but the get.php not properly get the value and display on the php page. That may be because your ajax request is sent to "cart.php" 46 minutes ago, aveeva said: $.ajax({ type: 'POST', url: 'cart.php', data: { voice_id : voice_id, voice_name : voice_name }, Quote Link to comment Share on other sites More sharing options...
aveeva Posted June 12, 2019 Author Share Posted June 12, 2019 stupid question,, thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.