Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script>
- <script type="text/javascript" src="https://raw.githubusercontent.com/carhartl/jquery-cookie/master/src/jquery.cookie.js"></script>
- <script>
- $(document).ready(function(){
- $("#submit").click(function(){
- var kode = $("#kode").val();
- $.ajax({
- type: "POST",
- url: "proses.php",
- data: "kode="+kode,
- success: function(msg){
- $("#hasil").show();
- $("#hasil").html(msg);
- var cokis = $.cookie("hasilnya");
- if(cokis != "undefined"){
- $("#selectbox option[value='"+cokis+"']").attr("selected", "selected");
- }
- $("#selectbox").on("change", function(){
- var hasilselect = $(this).val();
- $.removeCookie("hasilnya");
- $.cookie("hasilnya", hasilselect, {expires: 365, path: '/'});
- });
- }
- });
- });
- });
- </script>
- </head>
- <body>
- <form>
- <input id='kode' type='text' placeholder='Enter text ..'></input>
- <input type='button' id='submit' value='submit'/>
- <div id='hasil' ></div>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement