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

  • SEARCH
  • Home
  • 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 8158713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:41:58+00:00 2026-06-06T17:41:58+00:00

when a submit button is clicked i want to generate a pop up showing

  • 0

when a submit button is clicked i want to generate a pop up showing the list of items. The code i tried to create pop up is as follows:`

Index View:

<script type="text/javascript">
$('#popUp').Hide();
$('#button').click(function () {
    $('#popUp').click();
});
</script>

<div class="left-panel-bar">
@using (Html.BeginForm(FormMethod.Post))
{
        <p>Search For: &nbsp;</p>
        @Html.TextBox("companyName",Model);
        <input id="button" type="submit" value="Submit" />
}
</div>

<div id="popUp">
    @Html.ActionLink("Get Company List", "CreateDialog", "Company", null, new 
    { 
        @class = "openDialog", 
        data_dialog_id = "emailDialog", 
        data_dialog_title = "Get Company List" 
    });
</div>

but i got trouble using this code.. when i click the submit button it opens another page instead of popup. The controller code is as follows:

[HttpPost]
public ActionResult Index(Companies c)
{
    Queries q1 = new Queries(c.companyName); 
    if (Request.IsAjaxRequest())
        return PartialView("_CreateDialog", q1);
    else
        return View("CreateDialog", q1);
}
  • 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. Editorial Team
    Editorial Team
    2026-06-06T17:42:01+00:00Added an answer on June 6, 2026 at 5:42 pm

    You could use AJAX:

    <script type="text/javascript">
        $(function() {
            $('form').submit(function() {
                $.ajax({
                    url: this.action,
                    type: this.method,
                    data: $(this).serialize(),
                    success: function(result) {
                        $('#popUp').html(result);
                    }
                });
                return false;
            });
        });
    </script>
    
    <div class="left-panel-bar">
        @using (Html.BeginForm())
        {
            <p>Search For: &nbsp;</p>
            @Html.TextBox("companyName", Model);
            <input id="button" type="submit" value="Submit" />
        }
    </div>
    
    <div id="popUp">
    </div>
    

    Now ehn the form is submitted, an AJAX request will be sent to the Index POST action and since inside you test if the request was an AJAX request it will return the _CreateDialog.cshtml partial view and insert it into the #popUp div. Also it is important to return false from the form submit handler in order to cancel the default even which is to redirect the browser away from the current page.

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

Sidebar

Related Questions

I want the submit button to disappear after it's clicked and a new layer
So I want a Button1 to be clicked when the submit button has been
I have multiple check boxes. When the Submit button is clicked I want to
I am using isset function to check if the submit button is clicked, but
Currently my page has a submit button which is disabled when it is clicked,
This is my code for my submit button. Once data submitted to mysql i
I want this to be a command button not a submit button, so that
I want to add a function to a form, so when the submit button
I have a submit button that has got a dynamically generated id. I want
I have a submit button, created from - basically when this is clicked I

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.