What I would like to achieve is to be able to pass a parameter from my javascript function through ajax but that said variable will reach my c # method that I am calling.
Ajax code:
$.ajax({
url: "../../../pagina/configuracion/empresa/confEmpresa.aspx/getPlanta",
data: { var1: 0},
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8"
I'm trying to do it this way but when I load the page I do not get information, before I got the information correctly, but I made this modification and it stopped working. Am I sending the variable incorrectly?
I have not seen any errors in the console and apparently the page load is broken because it does not show information, the server does not receive the parameter and therefore the method is not executed. if the request is successful I should show an accordion with all the plants of my company depending on the BD.
Code C #
#region getPlanta
[WebMethod]
public static string getPlanta(int identificador)
{
string resultado = "";
List<DataTable> listado = new List<DataTable>();
Empresa empresa = new Empresa();
resultado = empresa.getPlanta();
string conteo = resultado.Substring(resultado.Length - 1);
/**listado=getAutorizaciones(conteo);**/
return resultado;
}
#endregion