Put it into a separate function and use the OnClientClick attribute in your button's tag.
<script type="text/javascript">
$(document).ready(function () {
});
function callAjax()
{
$.ajax({
type: 'GET',
url: 'https://js.i-parcel.com', [^]
timeout: 15000,
success: function (data) { alert('Connected to i-parcel.'); },
error: function (XMLHttpRequest, textStatus, errorThrown)
{ alert('Error:\r\n' + textStatus); }
});
}
</script>
<asp:button runat="server" id="btnClick" onclientclick="callAjax(); return false;" text="Click Here" />