Click here to Skip to main content
11,706,007 members (52,929 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET Java script
Hi Experts,

I have One Question....

Suppose, I have one Website.
In this, there is one page like Page1.aspx
Now Another page is Page2.aspx

Page2.aspx contain one function in page load event.

Now, I want to fire request through java script from Page1.aspx on Page2.aspx and execute that function, and that function should return any value to Page1.aspx through that request.

How can it possible ????????

Anybody can help me?

Mahesh Patel
Posted 12-Jul-11 2:59am

1 solution

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

Solution 1

You can do this by Ajax.

Add reference of “jquery-1.4.1.min.js” or ”jquery-1.5.1.min.js” in your .aspx page.

In below code Javascript function "JqueryAjaxExample" will call Page Load Of Page2.aspx.

Javascript function "JqueryAjaxExampleResponse" will invoke when response will come back from Page2.aspx.

<script language="javascript" type="text/javascript">
     function JqueryAjaxExample() {
            type: "GET",
            url: "Page2.aspx",
            success: function (ReturnValue) {
    function JqueryAjaxExampleResponse(ReturnValue) {

Then write your return value to Response in your function as below.

//Page Load of Page2.aspx
protected void Page_Load(object sender, EventArgs e)
private void ReturnValueFunction()
    string ReturnValue = "SomeThing";
Mr. MAHESHKUMAR at 12-Jul-11 9:38am
Thanks, It is working
RaisKazi at 13-Jul-11 1:12am
Perfect. Cheers !!!

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 151
1 OriginalGriff 151
2 Mika Wendelius 70
3 ppolymorphe 61
4 chainerlt 60
0 OriginalGriff 9,050
1 Sergey Alexandrovich Kryukov 8,417
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,636

Advertise | Privacy | Mobile
Web01 | 2.8.150819.1 | Last Updated 12 Jul 2011
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