I have a function that returns an element's top and left position, like so
$(function GetPos(El) {
var Offset = $(El).Offset();
var Top = Offset.Top;
var Left = Offset.Left;
return { x: Top, y: Left };
});
I need to be able to assign and store those values using C#
. I think Ajax
could be the answer, but I don't know how I would set it up.
I'd like to do something like:
Int Top = someAjax[1];
Here is a better example using jQuery - this is probably the easiest way to do it.
$.ajax({
type: "POST",
url: "Default.aspx/DoSomething",
data: {someParam: "some val"},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
//If anything needs to done after ajax call happens
}
});
On the server:
public void DoSomething(string someParam)
{
//Do whatever you need to
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.