javascriptphpjquerymysqljqmodal

How can I submit my jquery modal form


I have a simple jquery modal form. I think there is only a little problem but I can't trace where's the error. Please help. Here is my form field

    <form id="dialog-form" action="insertcus.php" method="post">
    <fieldset>
        <label>Name</label></br>
        <input type="text" style="height:20px;width:150px" id="name" name="name" class="text ui-widget-content ui-corner-all"></br>
        <label>Address</label></br>
        <textarea  class="text ui-widget-content ui-corner-all"required="required" rows="3" cols="29" id="address" name="address" form="dialog-form">
</textarea></br>
        <label>Mobile Number</label></br>
        <select class="text ui-widget-content ui-corner-all" required="required" name="con1" id="con1" style="height:30px;width:55px">
    <option value=""></option>
    <option value="0905">0905</option>
    <option value="0906">0906</option>
    <option value="0907">0907</option>
    <option value="0908">0908</option>
    <option value="0910">0910</option>
    <option value="0912">0912</option>
    <option value="0914">0914</option>
    <option value="0915">0915</option>
    <option value="0916">0916</option>
    <option value="0917">0917</option>
    <option value="0918">0918</option>
    <option value="0919">0919</option>
    <option value="0920">0920</option>
    <option value="0921">0921</option>
    <option value="0922">0922</option>
    <option value="0923">0923</option>
    <option value="0925">0925</option>
    <option value="0926">0926</option>
    <option value="0927">0927</option>
    <option value="0928">0928</option>
    <option value="0929">0929</option>
    <option value="0930">0930</option>
    <option value="0932">0932</option>
    <option value="0933">0933</option>
    <option value="0934">0934</option>
    <option value="0935">0935</option>
    <option value="0936">0936</option>
    <option value="0937">0937</option>
    <option value="0938">0938</option>
    <option value="0939">0939</option>
    <option value="0942">0942</option>
    <option value="0943">0943</option>
    <option value="0946">0946</option>
    <option value="0947">0947</option>
    <option value="0948">0948</option>
    <option value="0949">0949</option>
    <option value="0989">0989</option>
    <option value="0990">0990</option>
    <option value="0994">0994</option>
    <option value="0996">0996</option>
    <option value="0997">0997</option>
    <option value="0998">0998</option>
    <option value="0999">0999</option>
</select>
<input class="text ui-widget-content ui-corner-all" pattern="[0-9]{7}" maxlength="7"type="text" name="con2"  id="con2" required="required" style="height:20px;width:93px" >
    </fieldset>

    </form>

Here is my script:

<script>
$(function() {

    function updateTips( t ) {
        tips
            .text( t )
            .addClass( "ui-state-highlight" );
        setTimeout(function() {
            tips.removeClass( "ui-state-highlight", 1500 );
        }, 500 );
    }

    });


    $("#dialog-form").dialog({      
    autoOpen: false,        //Shows dialog
    height: 300,
    width: 220,
    modal: true,
    buttons: {
        "Cancel": function() {
            $( this ).dialog( "close" );
        },

       "Save": function() {
         $.ajax({
                url: "insertcus.php",                   //
                timeout: 30000,
                type: "POST",
                data:  $('#dialog-form').serialize(),



     });

        }

        }


});

    $( "#create-user" )
        .button()
        .click(function() {
            $( "#dialog-form" ).dialog( "open" );
        });



});







</script>

When I click he save button It doesn't do anything. What's wrong with my code? How can I submit this to my db?


Solution

  • 1° Fields do not have your names and identifiers

    2° Your code with this error because the function is missing closing

    is missing: "})"

    $(function() {});
    

    http://jsfiddle.net/BdRz3/1/