How to add cookie to remember Jquery state after form submit?

I want to add cookie to hide form for 15 minutes after submit. I tried everything and I did nothing. I have never used cookies! I am grateful to you for yours help. It works with "localStorage" but then I can't set expire time. My question is, where do I put cookie?

<script type="text/javascript">

 $(document).ready(function (){

$('form#forma1').submit(function(e) {
    e.preventDefault();// will stop the form being submited...

                type: "POST",
                url: "povezii.php",
                data: $(this).serialize(),
                success: function(data) {
                    $("#chatbox").append(data+"<br/>");//instead this line here you can call some function to read database values and display


    return false;




<div class="container">
<form id="forma1" class="forma1">

    <div class="col-md-6"> 

    <label name="odkoga"> From who: </label>
    <input type="text" name="odkoga" class="form-control"/> 

    <label name="zakoga"> For whom </label>
    <input type="text" name="zakoga" class="form-control"/>

    <label name="pjesmica"> Music wish: </label>
    <input type="text" name="pjesmica" class="form-control"/>
    <input type="submit" class="btn btn-success btn-block" value="Naruci"/>