AJAX call to server side function in javascript?
<p>I'm new to AJAX and I'm not too clear about how to use the format of the AJAX call
ex</p>

<pre><code>$.ajax({
    type: "POST",
    url: "Default.aspx/function",
    data: '{ searchBy: id }',
    contentType: "application/json; charset=utf-8"
}).success(function (result) {
    alert(result);
})
</code></pre>

<p>I have a function in the <code>.cs</code> file that should take in a string ID and return a list of all the objects that contain that ID.<br>
I want to call this function in the javascript to check that the returned list is null (therefore the ID does not already exist) before inserting new objects into the database.<br>
How could I go about doing this?<br>
All the examples I see return a <code>string</code> from the server side function.</p>