jquery writes a double-click to a variable

jquery writes a double-click to a variable

I have such a problem, I have a code, and in this whole program the idea is for him to perform some action under the condition of what will happen in the result variable and he performs this action but I will double on this button.
Code js

  1.  function edit_drugs (url, idDrugs, i, url2, url3) {
            $ ("# EditDrugs" + i) .load (url + "? IdDrugs =" + idDrugs);
            $ ("# updateDrugs" + i) .html ("<input type = 'button' class = 'btn btn-success' onclick = update_drugs ('" + url2 + "'," + idDrugs + "," + i + ", '" + url3 + "') value = 'Update entry'> ');
        }
        function update_drugs (url, id, i, url2) {
            var name = $ ("# nameProduct"). val ();
            var portion = = $ ("# portion"). val ();
            var date = $ ("# date"). val ();
            var time = $ ("# time"). val ();
            var result = $ ("# viewDrugs" + i) .load (url + "? id =" + id + "& nameProduct =" + name + "& portion =" + portion + "& date =" + date + "& time =" + time) .text ();
            if (result == "Ideally added") {
                alert (result);
            }
            //$("#EditDrugs"+i).load(url2 + "? Id =" + id);
        }
Code html
  1.     <Tr>
                    <td class = "center" colspan = "2">
                        <div id = "updateDrugs {{$ i}}">
                            <input type = "button" class = "btn btn-success" onclick = "edit_drugs ('{{url (' / ajax / edit_drugs ')}}', {{$ list-> idDrugs}}, {{$ and }}, '{{url (' / ajax / update_drugs ')}}', '{{url (' / ajax / show_update_drugs ')}}') "value =" Edit entry ">
                        </ Div>
                    </ Td>
                </ Tr>