Deprecated: Function create_function() is deprecated in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/plugins/wp-automatic/wp-automatic.php on line 70

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; COUNT_CLASS has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/functions.php on line 1713

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; sidebar_generator has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/plugins/multiple_sidebars.php on line 29

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_video_widgets has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/video.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_soundcloud has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/soundcloud.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_counter_widget has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/social-counter.php on line 9

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_news_in_pic has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/new-in-pic.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Flickr_Widget has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/flickr.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_fb_likebox has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/fb.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_google_follow has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/google-follow.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_popular has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/popular-posts.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_recent_posts has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/recent-posts.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_cate_posts has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/category-posts.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; tabs_widget has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/tabs.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_youtube_widget has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/youtube-subscribe.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_social_links has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/social-links.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_comments_widget has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/comments.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_author_bio has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/bio-author.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_login has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/login.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_search_widget has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/search.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Ad_120_600_Widget has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/ads120.php on line 7

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Ad_125_125_Widget has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/ads125.php on line 7

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Ad_250_250_Widget has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/ads250.php on line 7

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Ad_300_300_Widget has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/ads300.php on line 7

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_tweets_load has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/twittes.php on line 10

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; feedburner_widget has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/newsletter.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_related has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/related.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_slider has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/slider.php on line 6

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bd_top_rate has a deprecated constructor in /var/www/vhosts/eduardoarellano.com/d4mations.com/wp-content/themes/renad/includes/widgets/top-review.php on line 6
JavaScript: Post to PHP (AJAX) | D4mations.com
  • Thursday , 28 January 2021

JavaScript: Post to PHP (AJAX)

Code Canyon



A video tutorial showing you how to post JavaScript variables to PHP using AJAX

http://www.abell12.com
http://www.twitter.com/abell12youtube
http://www.facebook.com/pages/Abell12/265102633605437

Original source

3d Ocean

Related Posts

20 Comments

  1. Abel Alexander
    May 2, 2019 at 17:27

    Thanks man!

  2. David Weiler
    May 2, 2019 at 17:27

    is it possible to send html arrays to php?

  3. Rahul Khan
    May 2, 2019 at 17:27

    why its not working in newer versions of php

  4. Sudhanshu Singh
    May 2, 2019 at 17:27

    its JQUERY :'( not vanilla javascript!!! CHEATER

  5. Gothic Truth
    May 2, 2019 at 17:27

    THANK YOU BRO!!!!!!!!!! THAAAAAAANKS!!!!!!!!!!!!!!!! 🙂

  6. hitesh batra
    May 2, 2019 at 17:27

    Nice work
    but my content which is echoed is not shown or sometimes it just shown and vanishes please help me out

  7. Michael Avalos-Garcia
    May 2, 2019 at 17:27

    where did you declare the variable data?

  8. Dean O'Rourke
    May 2, 2019 at 17:27

    Great video!!

    I have a question, if I wanted to use this on a link instead of a button like the video, how could I get it to work? I've tried embedding the $.post function from your video into a click function for the link so far and it works by getting the elementID (a unique id for that anchor tag) and storing it in a variable. This part works. However, getting it to post to my php file thus far has been unsuccessful . It's for a project in college so any help at all would be appreciated!!

  9. Tylan Coleman
    May 2, 2019 at 17:27

    How can I attache this form to an array?

  10. Tylan Coleman
    May 2, 2019 at 17:27

    Thanks for this

  11. MY _ DIXIE _ RECT
    May 2, 2019 at 17:27

    Nice video

  12. ZoommaiR
    May 2, 2019 at 17:27

    This is great if you want to use JQuery, I just don't.

  13. Moahmed Bozgia
    May 2, 2019 at 17:27

    saved my day ! very helpful thank you

  14. Manoj Bharti
    May 2, 2019 at 17:27

    you are a legend dude

  15. Hamada Saidi
    May 2, 2019 at 17:27

    its jQuery Gandalf!

  16. Bielan Camilo Neres
    May 2, 2019 at 17:27

    very good, tks

  17. Xes webmaster
    May 2, 2019 at 17:27

    Hi even if I copy your code 100% except for <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script&gt;

    It does nothing any advice?

    <head>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script&gt;

    </head>

    <body>

    <form>

    <input type="text" id="name" placeholder="name">

    <input type="text" id="age" placeholder="age">

    <input type="button" value="submit" onclick="post();">

    </form>

    <div id="result"></div>

    <script type="text/javascript">

    function post()

    {

    var name =$('#name').val();

    var age =$('#age').val();

    alert('name s = ' + name);

    $.post('validate.php',{postname:name,postage:age},

    funtion(data)

    {

    if(data=="1")

    {

    $('#result').html('You are over 18');

    }

    if(data=="0")

    {

    $('#result').html('You are under 18');

    }

    });

    }

    </script>

    //validate.php
    <?php

    $name = $_POST['postname'];

    $age = $_POST['postage'];

    if ($age >=18)

    {

    echo "1";

    }

    else

    {

    echo "0";

    }

    ?>

  18. fuzzy buddy
    May 2, 2019 at 17:27

    could you please provide source code

  19. Ali Fakhoury
    May 2, 2019 at 17:27

    Are you coding on a river?

  20. Crisper Lawas
    May 2, 2019 at 17:27

    can I get js variable to php without submitting?

Leave A Comment

You must be logged in to post a comment.