There is function that get name from database using Jquery Ajax. This function have input parameter that I get it with below code:
var value = $(this).parent().find(":checkbox").val();
var typeSelect = GetLayerGeometries(value);
Then send value to ajax function:
Ajax Function:
function GetLayerGeometries(LayerName) {
var data;
$.ajax({
url: 'GetLayerGeometries.aspx/GetLayerGeometry',
data: '{"LayerName":"' + LayerName + '"}',
async: false,
success: function (resp) {
data = resp;
callback.call(data);
},
error: function () { }
});
return data;
}
C# Function:
protected void Page_Load(object sender, EventArgs e)
{
string test = Request.Form["LayerName"];
GetLayerGeometry(Request.Form["LayerName"]);
}
public void GetLayerGeometry(string LayerName)
{
WebReference.MyWebService map = new WebReference.MyWebService();
string Name = map.GetLayerGeometries(LayerName);
if (Name != null)
Response.Write(Name);
}
My problem: LayerName
is null.
I use this link and test all ways,but LayerName still is null.