title: Using jQuery AJAX to call ASP.NET function in control code-behind instead of page code-behind
body: <p>I have a user control that I'm creating that is using some AJAX in jQuery.</p>
  
  <p>I need to call a function in the code-behind of my control, but every example I find online looks like this:</p>
  
  <pre><code>$("input").click(function() {
      $.ajax({
          type: "POST",
          url: "Default.aspx/GetResult",
          data: "{}",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          success: function(result) {
              //do something
          }
      });
  });
  </code></pre>
  
  <p>This works fine if I have the method in the Default.aspx page. But I don't want to have the function there, I need the function in the code-behind of my control. How can I modify the url property to call the correct function?</p>
  
  <p>I tried:</p>
  
  <pre><code>url: "GetResult"
  </code></pre>
  
  <p>but that didn't work.</p>