I'm learning javacript, and I'm about at the point where I want to start doing some asychronous stuff. Here is the gist of my quest:
I have HTML code that looks like this:
<a id='nine' onclick="SendToServer('nine');">Nine</a>
I then want a way to, in Javascript, send back to the server that a#nine was clicked.
function SendToServer(id)
{
//Send that a#nine was clicked back to server
}
I then want some sort of handler function in c# to update an entry in a database.
public void GetMessageFromJSHandler(int id)
{
Item[x][y] = id;
}
I don't want the page to reload, I don't want anything to change on the page, and I want to do this in straight javascript so that I can learn how it works.
This is a GREAT resource: http://msdn.microsoft.com/en-us/library/ms178210.aspx I ended up altering this example for my needs. All Js and very straightforward.