Chapsterj
Chapsterj

Reputation: 6625

Using get method on form

I have a form that I just want to test if my input values are getting submitted correctly. I don't have any serve script setup yet but I thought I might be able to see my values been appended to my url when I click submit.

Here is what I have so far.

<form id="appointments" action="" method="get">
    <input  type="checkbox" name="check1" value="my value"/>
</form>

I have a div with a graphic on it which is been used for the submit and this is the code I'm using.

submit.click(function(evt){
    evt.preventDefault();
    $this.submit();
});

this is referring to the form id (id="appointments").

When I submit nothing gets appended to my url. Anyone know why.

Upvotes: 0

Views: 63

Answers (3)

Evan
Evan

Reputation: 6115

shouldn't it be

$("#yoursubmitbutton").click(function(evt){
      evt.preventDefault();
      $("#appointments").submit();
}

Upvotes: 0

xkeshav
xkeshav

Reputation: 54032

your declaration is wrong because normal javascript variable can be started with $, so $this is just a local variable, unless you use $this = $(this)

so instead of using $this use $(this) or this.something

Upvotes: 1

Rafay
Rafay

Reputation: 31043

use

$this = $(this);

also its not clear from the code to which elements you are attaching the click handler but you can try

$("form#appointments").submit();

Upvotes: 0

Related Questions