Click here to Skip to main content
13,089,943 members (41,957 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 12-Jul-11 9:38am
Thanks, It is working
RaisKazi 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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 12 Jul 2011
Copyright © CodeProject, 1999-2017
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