How to pass a string from javascript to server? and then get a return value from server in asp.net webforms
<p>I have this modal. inside a form tag</p>

<pre><code>&lt;div id="Incoming_Call" class="modal fade" role="document"&gt;
    &lt;asp:Label runat="server" id="Caller_id" Text="Incoming Call"&lt;/asp:Label&gt;
&lt;/div&gt;
</code></pre>

<p>I want to change the label text when the modal will show</p>

<pre><code>&lt;script&gt; 
string id = "temporary value"//javascript has this value on clientside.
// i don't have this value on page load but after some event triggers.

$('#Incoming_call').on('shown', function(){
    id="zetawars@hotmail.com";
    var text  = '&lt;%= generatestring(id)%&gt;';
    $('#&lt;%=Caller_id.ClientID%&gt;').html = id;
});
&lt;/script&gt;
</code></pre>

<p>I need to send that <code>id</code> variable to server side to a function <code>generateString()</code> after the string has changed from <code>id="temporary Value"</code> to  <code>id="zetwars@hotmail.com"</code> or something</p>

<p>This is on server side.</p>

<pre><code>public string generateString(string id)
{
     id = // does some processing;
     return id;
 }
</code></pre>

<p>So, I want to send a variable of javascript to the server side then server has to do some processing and return the value. the javascript variable is not ready at page load time. So I can't pass it inside <code>&lt;%%&gt;</code> these tags and get a newer value. It will only pass "temporary value" as a string not the new value.</p>