Click here to Skip to main content
11,634,634 members (68,030 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# jQuery
Suppose you have a page named Default.aspx. On this page there is a
Click here to see data comming from page method
. You want to show date in this div from a method in code file.
In Default.aspx.cs make a Method like this.
add following namespace.


public static string GetData()
return "Pakistan Zindabad";

//write this code on Default.aspx head section.
<script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>
<script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {

$("#div1").click(function () {

type: "POST",
url: "default7.aspx/GetData",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {





This solution is working fine.
Posted 26-Apr-12 7:40am
Wes Aday at 26-Apr-12 14:06pm
Reason for my vote of 1
This is not a question

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This looks like a Tip that you want to share with others.

Post here as a Tip/Trick: Publish Tip/Trick here on CodeProject[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,736
1 Sergey Alexandrovich Kryukov 8,359
2 Mika Wendelius 6,845
3 F-ES Sitecore 2,354
4 Suvendu Shekhar Giri 2,205

Advertise | Privacy | Mobile
Web04 | 2.8.150728.1 | Last Updated 26 Apr 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100