title: Force a postback inside a WebMethod
body: <p>I am using a 3rd party control for GIS map related functions. 
  I had the need to call a C# Method from within javascript. I chose to use <code>PageMethods</code> like this:</p>
  
  <pre><code>PageMethods.getFeature(x,y)
  </code></pre>
  
  <p>Works like a charm as long as you convert your method to a <code>[WebMethod]</code></p>
  
  <p>In this method I am passing in the coordinates of the mouse and it returns me map features. That I will highlight on the map. </p>
  
  <p>From researching I found that you cant directly access the UI from inside a [WebMethod] so I decided to set a session variable and postback. On postback if the session variables exist I would make the necessary UI changes. </p>
  
  <p>My <code>WebMethod</code> looks like this:</p>
  
  <pre><code>[WebMethod(EnableSession = true)]
          public static void getFeature(float x, float y)
          {...
          some code in here. 
          }
  </code></pre>
  
  <p><strong>Update</strong>
  This is my jQUery:</p>
  
  <pre><code>  &lt;script&gt;
          $(document).ready(function (e) {
              $(".MyMap").click(function (e) {
                  var posX = $(this).position().left;
                  var posY = $(this).position().top;
                  PageMethods.getFeature(e.pageX-posX, e.pageY-posY);
                });
          });
      &lt;/script&gt;
  </code></pre>
  
  <p>How do I force a postback inside of a <code>WebMethod</code>. Most of the ways I know to postback don't work. </p>