$.ajax Returning HTML of the page instead of results

旧城冷巷雨未停 提交于 2019-11-30 20:39:50

Well after banging my head against my desk for a full day I finally figured out what was wrong.

I was missing the following key in my <system.web> in my web config

<httpModules>
  <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>

I guess that IIS7.5 doesn't care if that line is there or not, but IIS6 needs to have that line there in order for web methods to function.

Thanks everyone for the help!

Change your server method to return JSON:

[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static bool CheckInvoiceExists(string vendorNumber, string invoiceNumber)
    {
        try
        {
            return RequestEntry.CheckInvoiceExists(vendorNumber, invoiceNumber);
        }
        catch (Exception exp)
        {
            EventLogging.LogError("Error checking if invoice exists: " + exp.Message);
            return false;
        }
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!