php - Checkbox value does not show in confirm popup javascript -


i have made email sending form , in confirmation popup window show preview email information user. in code form text input show correctly, no data show checkbox in preview pop window.i need show checkbox data in confirm box.

thanks all

here code

index.php

<!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title></title> <meta charset="utf-8"> <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"> <script src="js/jquery_003.js"></script>  <script src="js/mail.js"></script>    </head> <body style="margin: 0px;">              <div class="onedari_form_wrapper info_form_wrapper ajast_onedari_form mgt0">                 <form id="contactform">                     <div class="form_field">                         <label id="name">name<span class="red">*</span></label>                          <input kl_virtual_keyboard_secure_input="on" placeholder="name" class="custom_input" name="name" type="text" required>                     </div>                     <div class="form_field">                         <label id="mail">email<span class="red">*</span></label>                         <input kl_virtual_keyboard_secure_input="on"  class="custom_input" name="mail" type="text" required>                     </div>                     <div class="form_field">                         <label id="age">age<span class="red">*</span></label><br>                         <input kl_virtual_keyboard_secure_input="on" style="width: 30%" placeholder="" class="custom_input" name="age" type="text" required>                     </div>                     <p style="margin: 0px 0px 8px;"><label id="work">work<span class="red">*</span></label></p>                                                <div class="category-wrapper">    <input  id="categorycategory10" class="checkbox" value="10" name="data[]" type="checkbox" >  <label for="categorycategory10">app development</label>   <br>                                          <input  id="categorycategory209" class="checkbox" value="209" name="data[]" type="checkbox"> <label for="categorycategory209">system management</label>           <br>                                                                        <input  id="categorycategory213" class="checkbox" value="213" name="data[]" type="checkbox"> <label for="categorycategory213">web</label><br>                                             <input id="categorycategory19" class="checkbox" value="19" name="data[]" type="checkbox"> <label for="categorycategory19">graphics</label><br>                     <br>                      <button id="send" class="submit bg_red" type="button" name="send">submit</button>                  </form>             </div>     </body> </html> 

mail.js

$(function(){     // sendform     $("#send").on("click", function(e){         e.preventdefault();         chackerror("#contactform");     });      $(document).on("click", ".layeroff", function(){         $(".overlay").remove();     }); });   function chackerror(selector){     var $form = $(selector);     var name = $form.find("input[name='name']").val();     var mail = $form.find("input[name='mail']").val();     var age = $form.find("input[name='age']").val();     /*var work = $form.find("textarea[name='work']").val();*/      var dataval =  document.getelementsbyname("data[]");               // or document.queryselectorall('[name="summer[]"]');  var checked = [].filter.call( dataval , function( v ){     return v.checked; });        $form.find(".coution").remove();     var error_frag = false;       if ( checked.length < 1 ) {   $("#work").append("<span class='coution'><br>work field reqire</span>");         error_frag = true;         error_kind = "#work";        }      if(age == ""){         $("#age").append("<span class='coution'><br>age field reqire</span>");         error_frag = true;         error_kind = "#age";     }     if(mail == ""){         $("#mail").append("<span class='coution'><br>email field reqire</span>");         error_frag = true;         error_kind = "#mail";     }     if(name == ""){         $("#name").append("<span class='coution'><br>name field reqire</span>");         error_frag = true;         error_kind = "#name";     }     if(error_frag === false){            var theanswer = confirm("please confirm following information correct:\n  name:" +name+"\nage :"+age+"\njob :"+checked ); //if user presses "ok" button display message "javascript cool!!"          }       if (theanswer){sendform(); }      else{         var targety = $(error_kind).offset().top;         var headerh = $("#header").height();         var ajast = ($(window).width() >= 761)? 80 : 20;         $("html, body").animate({ scrolltop: targety - headerh - ajast}, 'fast');     } }   function sendform(){       var post_data = $("#contactform").serialize();     $("#contactform").find("input, checkbox, textarea").val("").end().find(":checked").prop("checked", false);     $.post("sendmail.php",         post_data,         function(data){             if(data.success === false){                 alert("error");                 $(".overlay").remove();             }else{                 $("body").append("<div class='overlay'></div>");                 $(".overlay").html(data.message);                 $("html, body").animate({ scrolltop: 0}, 'fast');              }         },         "json"     );     return false; } 


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -