hello sir,
i ma trying to store longitude and latitude vallue in label control but it gets null on ppostback..
how to store it in database then?
$.ajax({
type: "POST",
url: "MerchantRegistration.aspx/SaveLocation",
data: JSON.stringify(location),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
// alert(data.d[0]);
$('.longitude').html(data.d[0]);
return true;
}
});
in webmethod:
[System.Web.Services.WebMethod]
public static string[] SaveLocation(string lattitude, string longitude)
{
// "Latitude: " + lattitude + " Longitude: " + longitude;
string[] a = new string[2];
a[0] = longitude;
a[1] = lattitude;
HttpContext.Current.Session["longitude"] = longitude;
HttpContext.Current.Session["latitude"] = lattitude;
return a;
}
on server click:
protected void OnTest(object sender, EventArgs e)
{
string str = lblLongitude.Text;
}
reply asap.
thank you.