meWantToLearn
meWantToLearn

Reputation: 1700

add values to a form and send it to server using jquery submit

i have a form which has

<button id="112" class="cc">EDIT</button>

so what i want to do is to use jquery submit function and send the id of button to server, i know how to get the id of button , but sending a jquery variable to server i cant find a solution. this is what i have done so far

$('.button').click(function(){var dd=this.id; $('form').attr("edit.php");$('form').submit(); 

found on net there is submit(function) but how can i send variable dd to server, WITHOUT using AJAX. i want normal form submit

Upvotes: 0

Views: 608

Answers (1)

Infra Stank
Infra Stank

Reputation: 816

Add it as a url varible

$('.button').click(function(){
      $('form').attr("action", "edit.php?id="+ this.id).submit();
});

Then retrieve it use GET , if you're using php it will be $_GET['id'] .

Upvotes: 1

Related Questions