Home Conflict on script ajax with others
Reply: 0

Conflict on script ajax with others

user3130
1#
user3130 Published in April 19, 2018, 10:01 am

My script is causing conflict with others, when I use the line .noConflict (); it works fine, but another script stops working. If I remove the line .noConflict (); the script stops working and another script returns to normal. What can it be? I use https://code.jquery.com/jquery-3.2.1.slim.min.js after body is open.

$(function() {
    $("#contact .button").click(function() {
        var name = $("#form_name").val();
        var email = $("#form_email").val();
        var text = $("#msg_text").val();
        var dataString = 'name='+ name + '&email=' + email + '&text=' + text;

        $.ajax({
            type: "POST",
            url: "email_demo.php",
            data: dataString,
            success: function(){
                $('#success').fadeIn(1000);
            }
        });

        return false;
    });
});

I try this but not work

            a$.noConflict();
            a$(function() {
                a$("#contact .button").click(function() {
                    var name = $("#form_name").val();
                    var email = $("#form_email").val();
                    var text = $("#msg_text").val();
                    var dataString = 'name='+ name + '&email=' + email + '&text=' + text;

                    a$.ajax({
                        type: "POST",
                        url: "email_demo.php",
                        data: dataString,
                        success: function(){
                            a$('#success').fadeIn(1000);
                        }
                    });

                    return false;
                });
            });

my form:

<form name="solicitarDemo" method="post" class="" id="contact">  
 <section id="left">
   <label for="form_name">Name</label>
     <input name="form_name" id="form_name" type="text" >

   <label for="form_email">Email</label>
     <input name="form_email" id="form_email" type="email" >
 </section>

 <section id="right">
   <label for="form_msg">Message</label>
     <textarea name="form_msg" id="form_msg"></textarea>
   <input id="submit" class="button" name="submit" type="submit" value="Send">
 </section>

</form>

<div id="success" style="width:60%; display: none;">
Solicitação enviada, aguarde nosso contato em breve.
</div>

scripts:

<body>
        <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>

        <!--  conflict with this script-->
        <script src="sliderPro/js/jquery.sliderPro.min.js"></script>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.306388 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO