Called Ajax with C # does not work

0

I created a project in VisualStudio 2015, a template ... The problem is that I can not make calls from jQuery Ajax. What is the reason?

C #

    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public static Response<ProductosSP_obj> ObtenerProductosSP(Int32 FolioSp)
    {
        Response<ProductosSP_obj> response = new Response<ProductosSP_obj>();
        response = ObtenerDatosCotizacion_BLL.Instances.ObtenerProductosSP(FolioSp, _autenticacion.NombreUsuario);
        return response;
    }

JS

ObtenerProductosMarcas: function (idSp) {
    $.ajax({
        type: "POST",
        url: "AdministrarSP.aspx/ObtenerProductosSP",
        data: "{FolioSp:" + JSON.stringify(idSp) + "}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (response) {
            if (response.d.RecordsCount > 0) {
                //* PROCESO PARA EL LLENADO DE LA TABLA INFORMATIVA

                //* SE LIMPIA LA TABLA PARA VOLVER A LLENARLA
                $('#ContenedorProductos').html('');

                //* SE RESETA EL PLUGING DE LA TABLA
                AdministrarSpecialPrice.ResetTable();

                $.each(response.d.ListRecords, function (indice, producto) {
                    $('#ContenedorProductos').append(
                            "<tr> " +
                                " <td style='text-align:center'>" + producto.pc_cantidad + "</td>" +
                                " <td style='text-align:center'>" + producto.prod_sku + "</td> " +
                                " <td style='text-align:center'>" + producto.prod_noparte + "</td> " +
                                " <td style='text-align:center'>" + producto.prod_desc + "</td> " +
                                " <td style='text-align:center'>" + formatNumber.new(producto.pc_precio, '$', 2) + "</td>" +
                                " <td style='text-align:center'>" + producto.tm_desc + "</td> " +
                                " <td style='text-align:center'>" + formatNumber.new(producto.pc_subtotalps, '$', 2) + "</td> " +
                                " <td style='text-align:center'>" + formatNumber.new(producto.pc_subtotaldl, '$', 2) + "</td> " +
                                " <td style='text-align:center'>" + producto.sp_id + "</td>" +
                                " <td style='text-align:center'>" + producto.tsp_desc + "</td> " +
                           " </tr>");
                });

                //* SE FORMATEA LA TABLA
                AdministrarSpecialPrice.Table();

                //* PROCESO PARA EL LLENADO DE LA TABLA INFORMATIVA
            }
            else {
                notiLog(response.d.UserMessage);
            }
        },
        error: function (xhr, ajaxOptions, thrownError) {
            alertaTimes("Error " + xhr.status + " " + thrownError);
        }
    });
},
    
asked by Damián Orozco 24.05.2017 в 19:45
source

1 answer

0

I found the error with the help of a colleague, it turns out that it is the configuration inside the folder

  

App_Code in the RouteConfig.cs file

What you need to do is change the AutoRedirectMode in your default property:

  

RedirectMode.Permanent - > RedirectMode.Off

.CS

public static class RouteConfig { public static void RegisterRoutes(RouteCollection routes) { var settings = new FriendlyUrlSettings(); settings.AutoRedirectMode = RedirectMode.Off; routes.EnableFriendlyUrls(settings); } }

To all who supported me, thank you!

    
answered by 31.05.2017 / 17:58
source