I'm trying to call a c# function from a javascript function:
In my default.aspx I have following code: (javascript)
<script type="text/javascript">
function App() {
var temp;
temp = PageMethods.Connect();
alert(temp);
}
</script>
(HTML)
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<div class="menuContent">
<p><a href="#" onclick="App();">blabla!</a></p>
<div id="navTreeContainer">
<div id="navtree"></div>
</div>
</div>
</asp:Content>
Default.aspx.cs
[WebMethod]
public static string Connect()
{
string test;
test = "test";
return test;
}
When I try this out nothing happens.
I don't know what I do wrong here...
Someone that can help me please ?
Thanks!