 <p>You could pass three types to data <strong>Type: PlainObject or String or Array</strong> (as mentioned in <strong><a href="http://api.jquery.com/jquery.ajax/" rel="nofollow">jQuery.ajax()</a></strong> documentation) and since you're passing an object you can't just put a variable <code>old</code> inside an object, you should pass name and value like <code>name: value,name: value,...</code>, so it should be like <code>old: old</code> :</p> <pre><code>var old=""; //---&gt;Define variable $('td').click(function(){ old=$(this).text(); //---&gt;Set variable $(this).prop('contenteditable', true); }); $('td').on('input',function() { ... data: { content: $(this).text(), date: $(this).siblings().first().text(), prod: $('tr:first-child th:nth-child(' + ($(this).index() + 1) + ')').text(), old: old //---&gt;Get variable } ... }); </code></pre> <p>Take a look to <strong><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects" rel="nofollow">Working with objects</a></strong> documentation.</p> <p><strong>NOTE :</strong> You have to declare you variable <code>old</code> globaly so it will defined inside the both events <code>click</code> and <code>input</code>.</p> <p>Hope this helps.</p> <hr> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var old=""; var show_notification = false; $('td').click(function(){ show_notification = true; old=$(this).text(); $(this).prop('contenteditable', true); }); $('td').on('input',function() { if(show_notification===true){ toastr.info(old,'Old text',{"timeOut": 2000}); show_notification = false; } });</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt; &lt;link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/1.3.1/css/toastr.css" rel="stylesheet"/&gt; &lt;script src="http://cdnjs.cloudflare.com/ajax/libs/toastr.js/1.3.1/js/toastr.js"&gt;&lt;/script&gt; &lt;table border=1&gt; &lt;tr&gt; &lt;td&gt;first td&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;second&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;third&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;</code></pre> </div> </div> </p>