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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:31:01+00:00 2026-06-17T09:31:01+00:00

In form submission i am giving action using jquery Here is my HTML code

  • 0

In form submission i am giving action using jquery

Here is my HTML code

<form name="frmSearchTops" id="frmSearchTops" method="post" onsubmit="searchitem();">
        <select  name="cboCityNameRes" id="cboCityNameRes">
          <option value=''>City</option>
             {foreach from= $arritemCities item=foo}                      
               {if $smarty.post.hdnCityName eq $foo}                                
                  <option value="{$foo}" selected="selected">{$foo}</option>          
               {else}    
                <option value="{$foo}" {if $foo eq 'City'} selected="selected"{/if}>
                     {$foo}
                </option>
               {/if}    
             {/foreach}    
        </select>
    <select name="cboMaterial" id="cboMaterial">
      <option value="">Material</option>
      <option value="CT">Cotton</option>
      <option value="SL">Silk</option>
    </select>
     <input name="btnSearch" type="button" value="Search" id="btnSearch"/>       
 </form> 

Jquery Code

<script type="text/javascript">
 function searchitem()
 {
    var strCity = $('#cboCityNameRes').val();
    $("#frmSearchTops").attr("action", "/womens-tops-" + strCity + ".php");
    $("#frmSearchTops").submit();
 }
 </script>

Here i am giving action to a dummy link womens-tops-chennai.php. In controller it will redirect to actual page.But for me its not working.Can i submit like this

  • 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-17T09:31:02+00:00Added an answer on June 17, 2026 at 9:31 am

    You are trying to submit form using button type which cannot submit the form, so instead call the function with the onclick event and your script has code to submit the form

    <input name="btnSearch" type="button" value="Search" id="btnSearch" onclick='searchitem();'/>
    

    working demo

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

Sidebar

Related Questions

Here is the form submission part var form=document.forms[mainForm]; form.setAttribute(action,url_action); form.setAttribute(method,post); form.setAttribute(enctype,multipart/form-data); form.setAttribute(encoding,multipart/form-data); form.submit(); Now
What is the difference between these two form submission methods? <form method=post action=gert.php onsubmit=return
Hi everyone I was using the jQuery form plugin to process form submission (found
I am using JQuery to perform form submission through an ajax request. I use
jquery form submission prevention using e.preventDefault() is not working in multipart form submission (
Using jQuery validation for ajax form submission and I would like to add a
I am using jQuery and MVC to do form submission like this @using (Ajax.BeginForm(Orders,
I'm trying to implement Ajax jQuery Form submission. The code I pasted below is
Can I intercept/interrogate the form submission values using jQuery in the $('#formid').submit(function() { });
I am doing form submission and validation using jQuery and from server side 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.