Form Submit with Fade Out Message using Jquery Ajax PHP

Поделиться
HTML-код
  • Опубликовано: 30 сен 2024

Комментарии • 62

  • @ravipatel5922
    @ravipatel5922 7 лет назад +1

    This guy made some mistakes...he didn't write 'return false;' after if condition when name and message fields r empty..and he forgot to put curleybraces('( )') after setTimeOut function..

  • @alinakhan7480
    @alinakhan7480 3 года назад

    Thank you so much best tutorial

  • @give_me_my_nick_back
    @give_me_my_nick_back 4 года назад

    that "friends" is so so annoying... only scummers and terrorists say "friends" out of context....

  • @techadon3648
    @techadon3648 7 лет назад +1

    i wanted to diss on this video about the voice but after i watched the whole tut, i can say its the best tutorial i had today... good work bro... very understandable

  • @danielmwambala8287
    @danielmwambala8287 7 лет назад +1

    its not working. not even validating the form

  • @04mittald
    @04mittald 8 лет назад +2

    very good video friend

  • @echendumichael6397
    @echendumichael6397 5 лет назад

    Tried every bit of this tutorial, but mine seems not to be working. Will appreciate a help.Thanks
    Form code:
































    Ajax and Jquery:

    $(document).ready(function(){
    $("#submit").click(function(){
    var name = $("#form_name").val();
    var email = $("#form_email").val();
    var phone = $("#form_phone").val();
    var subject = $("#form_subject").val();
    var message = $("#form_message").val();
    if(name =="" || email =="" || phone =="" || subject =="" || message =="")
    {
    $("#error_message").html("All fields are required");
    }
    else
    {
    $("#error_message").html("");
    $.ajax({
    url:"insert.php",
    method: "POST",
    data: {name:name},
    success: function(data){
    $("form").trigger("reset");
    $("#success_message").fadeIn().html(data);
    setTimeOut(function(){
    $("#success_message").fadeOut("slow");
    }, 2000));
    }
    });
    }
    return false;
    });
    });

    PHP:

  • @mohammadshakilhossain5312
    @mohammadshakilhossain5312 3 года назад

    thanks sir...
    it was awesome

  • @jube_07
    @jube_07 3 года назад

    Thank you 🤗🤗🤗

  • @thegamerboy786.
    @thegamerboy786. 4 года назад

    Ya man , suppose that some 10 fields are required and 9 field fill after click submit button then message came all field required and form reset so how can we say if data success then reset otherwise don't need to reset form can you tell me in a comment please reply.

  • @Максим-е7ь4г
    @Максим-е7ь4г 3 года назад

    Ok, friend

  • @FaisalJ662
    @FaisalJ662 7 лет назад +2

    this channel is the best source for ajax

    • @webslesson
      @webslesson  7 лет назад +1

      Thank you, have a nice day!

  • @itsameehmario7645
    @itsameehmario7645 7 лет назад +1

    On the line setTimeOut needs to be: setTimeOut(function() instead of setTimeOut(function( //mind the ROUND brackets

  • @theodoroszervas9619
    @theodoroszervas9619 7 лет назад

    I have a question. about $.ajax ();
    Data{name:name,message:message}
    the first is the name of my field in html and the second is the value of the .val() ?
    so , jquery will assign in the html field called 'name' the value of the name? ($('#name').val() ) ?
    Could you explain the communication between html form, php and jquery. I mean the whole process /mechanism / technique
    thank you for your time

  • @technicalmind8541
    @technicalmind8541 5 лет назад

    Dear Webslesson, i have a problem to print the message inside the html.
    my code is not working..
    please help me....

  • @kanchanbhaskar6236
    @kanchanbhaskar6236 6 лет назад

    very nice, 100 likes, thanks for such post, it's very helpful.

  • @nareshpal9450
    @nareshpal9450 7 лет назад

    Nice video sir, but i want reset my form any error in validation through PHP. Please make video on this or please provide a link if you already have.

  • @rasikkunwar5056
    @rasikkunwar5056 7 лет назад

    succes message is shoing but still page is reloading.Why that is happening

  • @techadon3648
    @techadon3648 7 лет назад

    for data fetching ..... $(this).serialize(); is cooler

  • @osmekmeghai2100
    @osmekmeghai2100 6 лет назад

    Hi, it works! but my form is at the bottom of my page so when I hit the submit button it goes to the top of the page. how do i make it stay on the bottom after hitting the submit button so the form is still in view so the user can see the error or success message?

  • @globalentertainment3169
    @globalentertainment3169 7 лет назад

    Can u make a Video on Sending email from Localhost using Ajax and PHP? please

  • @ifargantech
    @ifargantech 4 года назад

    What I am really looking for! Thank you for saving me!!

  • @developeraccount438
    @developeraccount438 5 лет назад

    Please create php CSRF ajax protection

  • @paulmoldovan9518
    @paulmoldovan9518 6 лет назад

    Nice but not working with tinymce plugin.

  • @jamesbarratt593
    @jamesbarratt593 6 лет назад

    Im not your friend.

  • @albanustemu7396
    @albanustemu7396 6 лет назад

    This is greate video for Ajax, it is also usefull

  • @abrahamroquel2121
    @abrahamroquel2121 8 лет назад

    Great video man, in my case the code worked with "type" instead of "method" but the rest is pretty good.

  • @codenation535
    @codenation535 6 лет назад

    Hello , if the user dosen't fill the form and he clicks submit it will display it the error that's okay but the data is gonna be inserted into the database anyway ! there is nothing that gonna stop it from executing the Sql code

  • @anshuyadav6063
    @anshuyadav6063 5 лет назад

    nice code tysm

  • @JIGA1up1
    @JIGA1up1 6 лет назад

    is sql injection possible
    ?

  • @adeelmalik8841
    @adeelmalik8841 7 лет назад

    sir plz tell me in ajax call what was name:name first name was the name we entered what is second name thnkx ???

    • @webslesson
      @webslesson  7 лет назад

      hi adeel, in ajax data option we have to first name is the name which we have use on php code and second name is value of name variable which we have define above, suppose in first name you have write first name then in php code you have to write $_POST["first_name] variable instead of $_POST["name] variable.

  • @aarifsolankey
    @aarifsolankey 5 лет назад

    not wrking

  • @thanoszacharias7041
    @thanoszacharias7041 7 лет назад

    I used the code that you provide, but unfortunately the form isn't submitted for some reason! Any ideas? the red message "all fields required works fine"...

    • @webslesson
      @webslesson  7 лет назад

      Have you include jquery file or not...

    • @thanoszacharias7041
      @thanoszacharias7041 7 лет назад

      Forget it, my mistake it's totaly working! Thanks for this code!

  • @SumitSharma-ub5ie
    @SumitSharma-ub5ie 7 лет назад +1

    so helpful

    • @webslesson
      @webslesson  7 лет назад +1

      Thank you Sumit Sharma for your kind words.

  • @divyanshupandey2708
    @divyanshupandey2708 5 лет назад

    neek hai

  • @junglibila368
    @junglibila368 5 лет назад

    Hi sir

  • @maxalexandrov6683
    @maxalexandrov6683 5 лет назад

    thanks man! helps me a lot!

  • @STSN3116
    @STSN3116 6 лет назад

    HI Can you make a Video on Full Form Validation using Jquery , AJAX and PHP (Form to Email )

    • @webslesson
      @webslesson  6 лет назад +1

      Hi kiran we have already publish form validation using jquery Ajax and PHP, please search our channel you can find this type of tutorial.

    • @STSN3116
      @STSN3116 6 лет назад

      Webslesson
      There is no Full Form Validation in your Entire Channel, What am looking for is a 2 Layer (Jquery and Php ) Validation of a Web-Form to Email

  • @karlachavez7501
    @karlachavez7501 7 лет назад

    Excelente video, tengo una pregunta, como puedo hacer para que el mensaje de success dure mas tiempo, pues se quita a los 2 segudos

    • @webslesson
      @webslesson  7 лет назад

      Thank you Karla Chavez for your gentle words.

  • @robiparvez
    @robiparvez 7 лет назад

    awesome work man, keep going, boss

  • @akshaymahajan6528
    @akshaymahajan6528 8 лет назад

    thank you sir...

  • @globalentertainment3169
    @globalentertainment3169 7 лет назад

    I just love all your videos. Keep going.

  • @haitamghalem6787
    @haitamghalem6787 8 лет назад

    thanks you soo mutch

  • @mannaweb4634
    @mannaweb4634 7 лет назад

    great 👍

    • @webslesson
      @webslesson  7 лет назад

      Dear Animesh Manna, you are most welcome. Stay connected with us.

  • @JIGA1up1
    @JIGA1up1 6 лет назад +1

    can anyone share the correct code? the one on url is incorrect :/