Click here to Skip to main content
11,584,208 members (49,159 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 OriginalGriff 430
1 Sergey Alexandrovich Kryukov 334
2 Richard Deeming 220
3 Dave Kreskowiak 200
4 virusstorm 194
0 OriginalGriff 1,663
1 Sergey Alexandrovich Kryukov 1,229
2 Abhinav S 701
3 Dave Kreskowiak 667
4 Suvendu Shekhar Giri 568

Advertise | Privacy | Mobile
Web04 | 2.8.150603.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