错误:使用Ajax发布时

When i click on register button the error is shown in console that "submit_form is not defined"

i check everything for the mistake but didn't find where i make mistake

please resolve my problem....

This is my Html

<form>
            <div class="modal-body" style="color: black;font-weight: bold">
                <div class="row">
                    <div class="col-md-12">
                        First Name
                    </div>
                </div> 
                <div class="row">
                    <div class="col-md-12">
                        <input id="fname" name="fname" type="text" placeholder="First Name" style="width: 291px;height: 40px;border: 1px solid #dcdcdc" required/>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12" style="margin-top: 15px">
                        Last Name
                    </div>
                </div> 
                <div class="row">
                    <div class="col-md-12">
                        <input id="lname" name="lname" type="text" placeholder="Last Name" style="width: 291px;height: 40px;border: 1px solid #dcdcdc" required/>
                    </div>
                </div>
                <div class="row" style="margin-top: 15px">
                    <div class="col-md-12">
                        Email Address
                    </div>
                </div> 
                <div class="row">
                    <div class="col-md-12">
                        <input id="email" name="email" type="email" placeholder="Your Email" style="width: 291px;height: 40px;border: 1px solid #dcdcdc" required/>
                    </div>
                </div>
                <div class="row" style="margin-top: 15px">
                    <div class="col-md-12">
                        Contact Phone
                    </div>
                </div> 
                <div class="row">
                    <div class="col-md-12">
                        <input id="phone" type="text" placeholder="Your Contact" style="width: 291px;height: 40px;border: 1px solid #dcdcdc" required>
                    </div>
                </div>  
                <div class="row" style="margin-top: 15px">
                    <div class="col-md-12">
                        Company Name
                    </div>
                </div> 
                <div class="row">
                    <div class="col-md-12">
                        <input id="company" type="text" placeholder="Company Name" style="width: 291px;height: 40px;border: 1px solid #dcdcdc" required>
                    </div>
                </div>  
                <div class="row" style="margin-top: 15px">
                    <div class=" col-md-12">
                        Account Type
                    </div>
                </div>
                <div class="checkbox">
                    <label><input name="account" class="account" type="radio" value="1">Entrepreneur</label>
                </div>
                <div class="checkbox">
                    <label><input name="account" class="account" type="radio" value="2">Executive</label>
                </div>
                <div class="checkbox">
                    <label><input name="account" class="account" type="radio" value="3">Corporate</label>
                </div>
                <div class="row">
                    <div class=" col-md-12">
                        Subscription Type
                    </div>
                </div>
                <div class="checkbox">
                    <label><input class="subscription" type="radio" value="1">Monthly Payments</label>
                </div>
                <div class="checkbox">
                    <label><input class="subscription" type="radio" value="2">One Time Annually</label>
                </div>
                <div class="modal-footer" style="margin-top: 20px">
                    <button type="button" id="mc-embedded-subscribe" class="btn btn-success" onclick="submit_form()">Register</button>
                </div>
            </div>
        </form>

this is my script

function submit_form(){

        var fname = jQuery('#fname').val();
        var lname = jQuery('#lname').val();
        var email = jQuery('#email').val();
        var contact = jQuery('#phone').val();
        var company = jQuery('#company').val();
        var account = jQuery(".account:checked").val();
        var subscription = jQuery(".subscription:checked").val();
        alert(fname);
        alert(lname);
        alert(email);
        alert(contact);
        alert(company);
        alert(account);
        alert('your subscription='+subscription);
        var page_path = "http://ableagenda.com/webapp/admin/register_user.php";
        var data_post = "fname="+fname+"&lname="+lname+"&email="+email+"&tel="+contact;
        jQuery.ajax({
            type : "POST",
            data : data_post,
            url : page_path,
            cache : false,
            processData : false,
            success function(){
                alert('Your Form is Submitted');
            }
            error:function(xhr, status, error) {
                alert('Error');
        }

        });
        // alert(account);


    }

You miss a comma after the success callback.

success function(){
    alert('Your Form is Submitted');
} // no comma...
error:function(xhr, status, error) {
    alert('Error');

These kind of errors should show up as a syntax error in your debugger though. I would also advice to use console.log() instead of alert() in the future, I can't believe how hard it must be to test this page with all these alerts showing up...

Also, a tool like http://www.jslint.com/ can help you spot these mistakes.