简体   繁体   中英

can someone explain this bit of code?

can someone explain this bit of code?

<script type="text/javascript"><!--

    $('#button-confirm').bind('click', function() {
        $.ajax({ 
            type: 'get',
            url: 'index.php?route=hybrid_directory/confirm',
                success: function() {
                    location = '<?php echo $continue; ?>';
            }
        });
    });

    function formSubmit()
    {
        document.getElementById("freecontactform").submit();
    }

//--></script>

button-confirm, when clicks submits the information from a php contact form. how is url and function - location used?

This is an ajax call, triggered when an element with an id of "button-confirm" is clicked.

When the ajax call is complete, the url relocates to whatever the PHP script loading this page defined as $continue

Here's the docs to the jquery ajax method: http://api.jquery.com/jQuery.ajax/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM