---
title: "simple jquery callback works on .net3.5 but nothing fires on .net 2.0"  
description: "simple jquery callback works on .net3.5 but nothing fires on .net 2.0"  
author: "Anonymous User"  
published: 2014-08-27  
updated: 2014-08-27  
canonical: https://www.mindstick.com/forum/2161/simple-jquery-callback-works-on-dot-net3-5-but-nothing-fires-on-dot-net-2-0  
category: "asp.net"  
tags: ["asp.net", ".net", "c#", "simple jquery", "jquery", "javascript", "simple jquery callback works", "simple jquery callback works on .net3.5 but nothing fires on .net 2.0"]  
reading_time: 2 minutes  

---

# simple jquery callback works on .net3.5 but nothing fires on .net 2.0

i have the following jquery postback method on the client

<%@ Page [Language](https://www.mindstick.com/startup/28/preply-the-fast-growing-platform-transforming-language-learning)="C#" AutoEventWireup="true" CodeFile="CallServerWithParameters.aspx.cs" Inherits="CallServerWithParameters" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

<script src="jquery-1.2.6.js" type="text/[javascript](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-javascript)"></script>

<script language="javascript">

$([document](https://www.mindstick.com/articles/328642/what-to-consider-while-choosing-a-software-documentation-tool)).ready([function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server)() {

$("#txtNoOfMales").change(function() {

var ticketRequired = this.value;

var options = {

type: "POST",

url: "CallServerWithParameters.aspx/GetAvailableTicketsForMales",

data: "{no:" + ticketRequired + "}",

contentType: "[application](https://www.mindstick.com/articles/12824/calculator-application-in-android)/json; charset=utf-8",

dataType: "json",

success: function(response) {

if (response.d != "") {

alert(response.d);

$("#txtNoOfMales").focus();

}

}

};

//Call the PageMethods

$.ajax(options);

});

});

</script>

</head>

<body>

<form id="form1" runat="server">

<div>

No of Male Tickets:<asp:TextBox ID="txtNoOfMales" runat="server"></asp:TextBox>

</div>

</form>

</body>

</html>

and the following [web method](https://www.mindstick.com/interview/746/how-do-you-invoke-a-web-method-of-web-service-in-ajax) on the [server side](https://www.mindstick.com/forum/318/how-to-call-javascript-fuction-in-server-side)

using System;

using System.Collections.Generic;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.Services;

public [partial class](https://www.mindstick.com/forum/155717/define-partial-class-in-mvc) CallServerWithParameters : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

}

[WebMethod]

public static string GetAvailableTicketsForMales(int no)

{

[string result](https://www.mindstick.com/forum/12841/in-mvc-how-do-i-return-a-string-result) = "";

int NoOfTicketsAvailable = 5;

if (no > NoOfTicketsAvailable)

{

result = "Only " + NoOfTicketsAvailable.ToString() + " Male ticket(s) avaialable. Please eneter a lower number!";

}

return result;

}

}

problem is everything [works fine](https://answers.mindstick.com/qa/115732/my-software-works-fine-on-windows-10-but-crashes-on-windows-11-why) on .net 3.5 but if i use the same code on .net 2.0 the webmethod event does not get call at all, anybody have any idea what i did wrong?

## Replies

### Reply by Sumit Kesarwani

Hi Ashish, try this:\

[System.Web.Services.WebMethod]

[System.Web.Script.Services.ScriptMethod]


---

Original Source: https://www.mindstick.com/forum/2161/simple-jquery-callback-works-on-dot-net3-5-but-nothing-fires-on-dot-net-2-0

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
