function clickSearchResult(resId) { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == XMLHttpRequest.DONE) { alert(xhr.status + ": " + xhr.response); } } xhr.open('POST', window.location, true); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr.send('id=' + resId); }