lundi 13 juin 2016

Ajax Post 500 Internal Server Error with asp.net

I have a problem with ajax

This is the code:

    $(document).ready(function () {

        show_page(1);

    });


    function show_page(page) {
        debugger;
        $.ajax({
            type: 'post',
            url: 'OrdiniServer.aspx',
            data: {
                page: page
            },
            success: function (response) {
                $("#table_ordini").html(response);
            }
        });

        return false;

    }

This function is included inside RistoratoreAccount.aspx which itself, is located inside a masterpage. So when I start this function, it should call the page "OrdiniServer.aspx", but the browser console gives me this error:

jquery-1.3.2.min.js:8 POST http://localhost:10343/OrdiniServer.aspx 500 (Internal Server Error)
send                      @ jquery-1.3.2.min.js:8
ajax                      @ jquery-1.3.2.min.js:8
show_page                 @ RistoratoreAccount.aspx:440
(anonymous function)      @ RistoratoreAccount.aspx:433
j                         @ jquery-1.3.2.min.js:3
fireWith                  @ jquery-1.3.2.min.js:3
ready                     @ jquery-1.3.2.min.js:3
J                         @ jquery-1.3.2.min.js:3

I tried to set the OrdiniServer.aspx with ContentPlaceHolder and without it but it still doesn't work.

I tried to use breakpoint on the codebehind but it doesn't start, so the error is not in the code...

So this is the OrdiniServer.aspx page:

<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/MasterBack.Master" CodeBehind="OrdiniServer.aspx.cs" Inherits="FoodDelivery.OrdiniServer" %>

<asp:Content ID="cp2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">

</asp:Content>

p.s. I tried this code with another project that doesn't have masterpage and it works...

Aucun commentaire:

Enregistrer un commentaire