Ошибка перенаправления Ajaxform - PullRequest
0 голосов
/ 10 октября 2019
Форма

на моем веб-сайте перенаправляет на пустую страницу вместо сообщения об успехе. Форма работает, сообщение получено, но после отправки я перенаправлен на пустую страницу с таким URL:

www.mywebsite.com / inc / sendemail.php? Name = as & email = asd% 40asd.sk & phone = 12456 & message= asd

Вот часть кода, которая управляет успешной отправкой

$.fn.ajaxSubmit = function(options) {
    /*jshint scripturl:true */

    // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
    if (!this.length) {
        log('ajaxSubmit: skipping submit process - no element selected');
        return this;
    }

    var method, action, url, $form = this;

    if (typeof options == 'function') {
        options = { success: options };
    }

    method = this.attr2('method');
    action = this.attr2('action');

    url = (typeof action === 'string') ? $.trim(action) : '';
    url = url || window.location.href || '';
    if (url) {
        // clean url (don't include hash vaue)
        url = (url.match(/^([^#]+)/)||[])[1];
    }

    options = $.extend(true, {
        url:  url,
        success: $.ajaxSettings.success,
        type: method || 'GET',
        iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
    }, options);

И код формы:

<form action="../inc/sendemail.php" class="form-styl-one form-validation" autocomplete="off">
                        <div class="row">
                            <div class="col-sm-4 col-xs-12">
                                <input type="text" placeholder="Vaše meno.." name="name">
                            </div>
                            <div class="col-sm-4 col-xs-12">
                                <input type="email" placeholder="Váš email.." name="email">
                            </div>
                            <div class="col-sm-4 col-xs-12">
                                <input type="text" placeholder="Váš telefón.." name="phone">
                            </div>
                        </div>
                        <textarea placeholder="Správa.." name="message"></textarea>
                        <input id="buttonsubmit" type="submit" class="tran3s" value="ODOSLAŤ">
                        <!--<div class="g-recaptcha" data-sitekey="6Ledj5oUAAAAACb2qS4VPKdzqqsqG-JpFwRUW3gN"></div>-->
                    </form>
                </div> <!-- /.container -->
                <!-- Contact Form Validation Markup -->
                <!-- Contact alert -->
                <div class="alert-wrapper" id="alert-success">
                    <div id="success">
                        <button class="closeAlert"><i class="fa fa-times" aria-hidden="true"></i></button>
                        <div class="wrapper">
                            <p>Vaša správa bola úspešne odoslaná.</p>
                         </div>
                    </div>
                </div> <!-- End of .alert_wrapper -->
                <div class="alert-wrapper" id="alert-error">
                    <div id="error">
                        <button class="closeAlert"><i class="fa fa-times" aria-hidden="true"></i></button>
                        <div class="wrapper">
                            <p>Ups, niečo sa pokazilo, skúte to prosím znova.</p>
                        </div>
                    </div>
                </div> <!-- End of .alert_wrapper -->
            </div> <!-- /.contact-us-form -->
...