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 6067351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:35:56+00:00 2026-05-23T09:35:56+00:00

I am trying to create some ajax. When the form is submitted it should

  • 0

I am trying to create some ajax. When the form is submitted it should not refresh and go to the action page. Instead it should render and replace the content in the div tag with the id formcontent.

Here is my jquery:

    // Place your application-specific JavaScript functions and classes here
    // This file is automatically included by javascript_include_tag :defaults
    $(document).ready(function() {
    // send form ved klik paa listen
    $('option').click(function ()
    {
        $(this).closest('form').submit();
    });
    });

My HTML:

<form method="post" id="new_konkurrancer" enctype="multipart/form-data" class="simple_form konkurrancer" action="/public/pricecompare" accept-charset="UTF-8">
    <select style=" margin-left:10px;width:370px;float: left;
        margin-top: 10px;"name="konkurrancer[form]" id="konkurrancer_form" class="select optional"><option value="">Vælg din A-kasse:</option>
    <option value="Nyhedsbrev">ASE</option>
    <option value="Quiz">Træ-industri-byg</option>
    <option value="Andet">Journalistik, kommunikation og sprog</option>
    <option value="Andet">Faglis fælles A-kasse (3F)</option>
    <option value="Andet">Danske lønmodtagere</option>
    <option value="Andet">Metalarbejderne</option>
    <option value="Andet">NNF</option>
    <option value="Andet">Byggefagense A-kasse</option>
    <option value="Andet">HK Danmark</option>
    <option value="Andet">Teknikkerne</option>
    <option value="Andet">Kristelig A-kasse</option>
    <option value="Andet">Frie funktionærer</option>
    <option value="Andet">Dana A-kasse</option>
    <option value="Andet">IT-faget og merkonomerne</option>
    </select>
    <div id="formcontent">

    Render view here on submit


    </div>
  • 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-05-23T09:35:56+00:00Added an answer on May 23, 2026 at 9:35 am
    $(document).ready(function() {
        // send form ved klik paa listen
        $('option').click(function ()
        {
            var form=$(this).closest('form');
            $.ajax({
              type:'post',
              url:form.attr('action'),
              data:form.serialize(),
              success:function(msg){
                $('#formcontent').html(msg);
              }
            });
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I've been trying to add some AJAX to my home page with rjs
everyone! i'm trying to create ExtJs form and post some data to my php
i am trying to create a login form page for codeigniter 2 within sencha
I'm trying to create some HtmlHelper extensions and ran into a bit of a
I'm trying to implement the WMD editor used on StackOverflow to create some basic
I'm trying to be a good developer and create some documentation before I start
Trying to create a list to return some JSON data to a view. Following
I'm trying to create a linq query based on some dynamic/optional arguments passed into
I've recently been trying to create units tests for some legacy code. I've been
I'm trying to create with Delphi a component inherited from TLabel, with some custom

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.