+ Reply to Thread
Results 1 to 2 of 2

Thread: Pass Var to a form using Jquery

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    15

    Pass Var to a form using Jquery

    I have a form and i want when pressing a button pass the var to my form , here is my code :
    Code:
    $(document).ready(function() {
    $("#submit").click(function() {
        $("#sortable").each(function() {
    
            var fieldNames = $(this).sortable('toArray').toString();
    
    
        });
        $("#detColumnSortorder").submit;
    });
    Thanks in advance.

  2. #2
    Junior Member
    Join Date
    Apr 2012
    Posts
    34
    You can do this using that trick : make a hidden input field inside your form Then set the value
    on the hidden field. That way when the form submits, the value in the hidden field will be submitted.
    Smart Huh ?

    Anyway here is the Code :
    HTML :
    Code:
    <input type="hidden" name="fieldNames" value="" />
    Jquery :
    Code:
    $(document).ready(function() {
    $("#submit").click(function() {
        $("#sortable").each(function() {    
            var fieldNames = $(this).sortable('toArray').toString();
            $('input[name=fieldNames]').val(fieldNames);
        });
        $("#detColumnSortorder").submit;
    });

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts