开发者

how to get return value from javascript to .cs page

// JScript File
f开发者_开发百科unction fnCheckBrowserType(var k)
{
if(k>0)
{
document.getElementByID('<%=HhdnBrowsertype.ClientID%>').value="1"
return true;
}
else
{
document.getElementByID('<%=HhdnBrowsertype.ClientID%>').value="0"
return false;
}

in.cs page load

Page.ClientScript.RegisterStartupScript(typeof(string), "fnCheckBrowserType", "fnCheckBrowserType();", true);

here i need to gets its return vale based on the return value "true " or "false" i need to check the condition

pls help me to get the value from javascript to .cs page

thanks prince


To send data to the server from the client, you have some options:

  • Send in a form.
  • Use Ajax.
  • Indirectly request a resource from the server and use a query string to send the information (for instance, adding an img element which uses a query string in its src). Not recommended, but possible and perhaps useful in some edge cases (for instance, when you need to send the data cross-origin and need to avoid the Same Origin Policy, as with many ad serving scripts).
  • Have the data piggy-back on your next normal request by setting a cookie.

Given the scenario you describe, Ajax may be your best option.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜