If you will use $.ajax you need to have included the jQuery source, and then you can also use the jQuery functions to do that.
Try this:
//Into your html "head" tag you need to have this:
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
//And then in your code you could have something like this:
$(document).ready(function () {
window.addEventListener('shake', shakeEventDidOccur, false); //You have now the task to find what jQuery function or method could be replacing this to make your code integrated completly
//define a custom method to fire when shake occurs.
function shakeEventDidOccur () {
var textboxValue = $('#textbox').val(); //Where textbox is the "id" attr of your textbox
$.ajax({url:"test.php"
type: 'GET', //can be POST too
url: '/wp-admin/admin-ajax.php',
data: { 'value': textboxValue},
success: function (request_data) {
//some code to execute after the call as a callback
}
});
}
});