Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 104385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:16:24+00:00 2026-05-11T01:16:24+00:00

So I’m trying to load some returned html from an .aspx page but a

  • 0

So I’m trying to load some returned html from an .aspx page but a click event needs to fire before it doing some stuff that the AJAX request depends upon. More specifically, I’m doing this. When a user types in a text field this function is run…

function KeyPress() {   $('#' + HiddenButtonId).click();   $('#test').load('TempJumpToAJAX.aspx'); } 

then $(‘#’ + HiddenButtonId).click(); does sets some session data in a code behind file. Specifically…

Session['SearchText'] = Search.Text; 

then, $(‘#test’).load(‘TempJumpToAJAX.aspx’); calls that .aspx page that returns a newly built select box…

        Response.Expires = -1;          StringBuilder builder = new StringBuilder();           builder.Append('<select id=\'testListId\' name=\'testList\' size=\'4\' style=\'width:200px;\'>');         builder.Append('<option>');         builder.Append(Session['SearchText']);         builder.Append('</option>');                     builder.Append('</select>');          Response.ContentType = 'text/HTML';         Response.Write(builder.ToString());         Response.End(); 

The problem is, the order seems to be screwed up it tries to append the Session[‘SearchText’] first, then runs the code that the click event runs. So it functions more like this…

function KeyPress() {   $('#test').load('TempJumpToAJAX.aspx');   $('#' + HiddenButtonId).click(); } 

Where the commands are reversed. So what in effect happens is the session variable has an empty string as opposed to what the user typed in the text box. What’s odd to me is that it doesn’t seem like it should have an empty string, it seems like it should have nothing since the session variable has not been initialized to anything at this point. I really have no idea what’s happening. Chalk it up to inexperience I guess. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:16:24+00:00Added an answer on May 11, 2026 at 1:16 am

    You are mixing technologies here. The hiddenButtonID click event is trying to do a full postback for the page, whereas the AJAX call will not do a postback. There is no reason to do a post back and then follow it up with an AJAX call. The point of AJAX is to eliminate the need to postback the page and instead just reload a small amount of the HTML on the page using a small callback to the server. Instead of accessing the Search Textbox text in the HiddenButtonID click event handler you should be passing that data to the Server in the AJAX call parameters.

    The following client side script should do this.

     function KeyPress() {   $('#test').load('TempJumpToAJAX.aspx', {searchText: $('#').val()}); } 

    In this code you are getting the ID of the search textbox and then using jQuery to retrieve the value of that text box. This will get passed to the TempJumpToAJAX.aspx page as POST variable called ‘searchText’. You should be able access this data by accessing the Request[‘searchText’] variable in the ‘TempJumpToAJAX.aspx’ page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 81k
  • Answers 81k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Declaring variables inside your cron job is more explicit and… May 11, 2026 at 4:30 pm
  • Editorial Team
    Editorial Team added an answer If you want to access the DataContext property in code… May 11, 2026 at 4:30 pm
  • Editorial Team
    Editorial Team added an answer Ok, this happens when I execute the code in localhost.… May 11, 2026 at 4:30 pm

Related Questions

So I'm getting a new job working with databases (Microsoft SQL Server to be
So I have a Sybase stored proc that takes 1 parameter that's a comma
So I'm embarking on an ASP.NET MVC project and while the experience has been
So I've got a JPanel implementing MouseListener and MouseMotionListener : import javax.swing.*; import java.awt.*;
So I wrote some perl that would parse results returned from the Amazon Web

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.