jquery ajax with asp.net not working

后端 未结 2 742
情书的邮戳
情书的邮戳 2021-01-05 16:52

I\'m about to pull out any remaining hair that I have, so please help me out if you know what the problem might be... Thanks. All my googling and searching has not paid off

相关标签:
2条回答
  • 2021-01-05 17:14

    You should call a function inside PageLoad Function

    If(!Page.IsPostback){
       ...
    }
    
    0 讨论(0)
  • 2021-01-05 17:17

    Thank you @DaveWard and @CodeRoller for your help which led to this solution:

    1. Install ASP.NET Ajax Extensions (HERE)
    2. Add reference to System.Web.Extensions.dll
    3. Modify web.config to include the ScriptModule httpModule (see below)

    My jQuery ajax call and the WebMethod are still the same as my original post.

    My web.config has been modified as below:

      <system.web>
        <compilation debug="true">
          <assemblies>
            <!-- A bunch of other assemblies here-->
            <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
          </assemblies>
        </compilation>
        <httpModules>
          <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        </httpModules>
      </system.web>
    

    I hope someone else will find this useful.

    0 讨论(0)
提交回复
热议问题