[Solved] WebMethod not calling using jQuery AJAX in ASP.Net

Last Reply one year ago By AbdulHaque

Posted one year ago

Hello everyone,

I am using jQuery Ajax post value from client side but its not working.

I am unable to figure kindly please help me.

Any suggestions will be appretiated.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="AJAX.Test" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script src="Scripts/jquery-3.4.1.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#btn').click(function () {            
            var no = 123;
                url: 'Test.aspx/show',              
                method: 'post',
                contentType: 'ápplication/json',
                data: '{Id:' + no + '}',
                dataType: 'json',
                success: function (data) {
                failure: function (data) {
    <form id="form1" runat="server">
    <input type="button" id="btn" value="Submit" />


namespace AJAX
    public partial class Test : System.Web.UI.Page
        public static string show(string id)
            return id;


Posted one year ago

Thank you all for your valuable reply.

Actually the problem is with Route.Config.cs file under this I have changed RedirectMode.Permanent to RedirectMode.off and it works for me.

Thanks once again regards

Changed RedirectMode.Permanent to RedirectMode.off;