1

I want to add the time variable when sending data with javascript

$(function() { 
$("#cetak").click(function(){
    var kode    = $('#noanggota').val();
    var id  = $(".id:checked").val();
    var jml_id = $(".id:checked");

    if(jml_id.length == 0){
       var error = false;
       alert("Maaf, Anda belum memilih");
       //$("#txt_user").focus();
       return (false);
     }
    window.open("<?php echo base_url();?>index.php/persetujuan_pinjaman?x=1&"+id+"="+kode); 
};  

Html code:

 <table width="100%">

<tr>
    <td><input type="radio" name="id" class="id" value="id" checked /> Masukan Nomor Anggota</td>
    <td><input type="text" name="noanggota" id="noanggota" /></td>
</tr>
 </table>    

how I want add variable date with this code ??

window.open("<?php echo base_url();?>index.php/persetujuan_pinjaman?x=1&"+id+"="+kode);   

2 Answers 2

2

Your code not properly closed with });

    $(function() { 
        $("#cetak").click(function(){
            var kode    = $('#noanggota').val();
            var id  = $(".id:checked").val();
            var jml_id = $(".id:checked");

             var mydate = new Date(year, month [, day, hour, minute, second, millisecond]);

            if(jml_id.length == 0){
               var error = false;
               alert("Maaf, Anda belum memilih");
               //$("#txt_user").focus();
               return (false);
             }
            window.open("<?php echo base_url();?>index.php/persetujuan_pinjaman?x=1&"+id+"="+kode+"&mydate="+mydate); 
        });

    }); 

For Date: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

Sign up to request clarification or add additional context in comments.

2 Comments

Yes you are right... but i want choose input variable from form date box.
What is your datebox input id -> var mydate = $('#datefiledid').val();
0

user js calender in your form as input box.

link http://javascriptcalendar.org/javascript-date-picker.php

download it and apply in your form also document is there.

now in your js read the value of date input box as you read input "noanggota"

and make url. hope you find the answer.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.