JavaScript: Post to PHP (AJAX)

Поділитися
Вставка
  • Опубліковано 19 вер 2024
  • A video tutorial showing you how to post JavaScript variables to PHP using AJAX
    www.abell12.com
    / abell12youtube
    / 265102633605437

КОМЕНТАРІ • 115

  • @laffypanda6822
    @laffypanda6822 9 місяців тому +1

    🙏 finally a concise and accurate source of information on this subject. Thank you, you saved my final project 😭

  • @DevendraSingh-sf9vo
    @DevendraSingh-sf9vo 10 місяців тому +1

    thank you for your code because it helped me in completing my project (Date : 10 oct 2023 , Time : 2:20AM)

  • @fatihtutar7583
    @fatihtutar7583 2 роки тому

    This video you took 9 years ago worked for me today thank you

  • @rdnewsham
    @rdnewsham 11 років тому

    This is just what I have been looking for. It's brill. Clear and concise.
    I like the way you can run PHP script WITHOUT having to refresh the home page.
    Thank you for sharing the information.

  • @poulioumaria5166
    @poulioumaria5166 6 років тому

    Thank you so much!!!!!!!!! After spending a whole day (and night) trying to figure out what's going wrong, I had the great opportunity to find your video! Again, thanks a lot!

  • @admhngla
    @admhngla 5 років тому

    Men I was going crazy fo days with an error of undefined index when I was using ajax. Thanks you have saved my career

  • @abell12
    @abell12  12 років тому +3

    AJAX means to use client programming to update or change the webpage in some way without actually refreshing the page. In this case we are sending some data to a PHP script which can be ran on the server making it possible to make server changes, once again without refreshing the page.

  • @RNRSeries-Mysuru
    @RNRSeries-Mysuru 4 роки тому

    I was searching searching... and was worried also... Found this and implemented it... God Bless You for making a good useful video.... Also please do make some more nice videos on advanced topics...

  • @rotimiidowu6848
    @rotimiidowu6848 3 роки тому

    God bless you my brother, this really helped me, have been looking for something like this

  • @JimmyDedicat
    @JimmyDedicat 11 років тому

    Thanks for the TUTs, i've been looking for this a whole week. THanks man... keep up the good work

  • @abell12
    @abell12  11 років тому

    Yes if you put this onto a button or link so it only happens when a function is ran and not when the page actually loads.

  • @youbelongtomeeee
    @youbelongtomeeee 6 років тому

    THANKS a lot! I'm able to solve my problem by looking at your video...

  • @OctaRudin
    @OctaRudin 3 роки тому

    Thank you. You solved my problem.

  • @lukebiller1747
    @lukebiller1747 8 років тому

    I downloaded the jquery-1.12.1.min.js file then added the javascript you show in the tutorial to the bottom of this file, then post the source in the html . It works fine, but I'm curious if this is the "correct" or "standard" way to do it?
    Great tutorial by the way...

  •  9 років тому +1

    Great Job! Greetings from Poland! Thank You very much!

  • @shaadali9282
    @shaadali9282 8 років тому +3

    Made my day. Great tutorial, well explained. God bless :)

  • @aprilcummings1918
    @aprilcummings1918 10 років тому +1

    Hello, I am not sure how much you check UA-cam but I thought it would be worth a post. First off, thank you for posting this, it is extremely helpful. However I am running into a couple of problems. Namely, my variables like your "postage" are not being recognized by my PHP. Also, I am not entirely sure where the post() and .val() functions came from, as they don't seem to be initialized anywhere. I am assuming they are predetermined by jquery or something, but that would be useful to know. Regardless, my form calls another js function as an action, and originally I had no intentions of adding a submit button, though I would if it will work. When I added it, it wasn't submitting the form... Currently I have-> action=function1() onsubmit=function2() I Need my "result" to be shown in a and not a do you know how I could make that happen? I tried span.variableName instead of #variableName but that didn't seem to work. Thanks!

  • @tryingtocorrect
    @tryingtocorrect 8 років тому

    Very nice. Finally some web-prog. tutorial which actually works. Just one question: if I want to echo on PHP side using echo so that it does not go back to javascript, how can I do it? I mean I just want to do echo normally in php file (so that the echo prints stuff on html page directly.... now it goes back to javasctip data and we do it there)? Also, if the javascript is in php file can I have all this code in php file or the php with if() must be a separate file? Can all this code be in one php file? I mean I do not want PHP to return back to javascript.... as I want to continue building the website on PHP side (like create a div on PHP side using the values got from javascript)?

  • @glennwoolum9457
    @glennwoolum9457 9 років тому

    Nice work here. I understood everything quickly.

  • @bigcitydreamz4444
    @bigcitydreamz4444 9 років тому

    Hey thanks for your tutorial I'm new at programming and I have a website that is php but I'm using JavaScript for programming my game that I want add to my site is this the way to go about doing it?

  • @voze1905
    @voze1905 7 років тому +1

    So i would recommend using json enode instead of just echoing 1 Or 0

  • @panagiotis9688
    @panagiotis9688 11 років тому

    No worries, I managed to find the problem, its Zend Frameworks particular syntax.
    PA

  •  10 років тому

    great tut i would like to know how to use php vars like a logged in username session instead of a user input and also a php var for if a user is vieing a friends profile page so i would like to know how to send 2 vars to a parser without refresh it is for a poke application i am making can you do a tut on this please?

  • @dumitrudan608
    @dumitrudan608 7 років тому

    Thanks for the tutorial, can you do this using only 1 file, that contains both the PHP and jQuery?

  • @LukeWatts85
    @LukeWatts85 8 років тому +7

    You should name your video "jQuery: Post to PHP (AJAX)" if you're going to use jQuery. Some of us are trying to learn how to do it the hard way first...

  • @RahulKhan-gz6wl
    @RahulKhan-gz6wl 5 років тому

    why its not working in newer versions of php

  • @RafaelAtantya
    @RafaelAtantya 4 роки тому

    thank you for saving my 3 hours

  • @HexaActers
    @HexaActers 7 років тому

    very very thanks to post this video it is very use full to me

  • @jguilhermecruz61
    @jguilhermecruz61 8 років тому

    How do if you want to call a PHP function within a class?

  • @tapankarmakar7198
    @tapankarmakar7198 3 роки тому

    after post every time i click on the link the post data keep showing... how to hide data if u refresh the page

  • @deano50z
    @deano50z 5 років тому

    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!!

  • @saeidj2470
    @saeidj2470 7 років тому +1

    I replaced the source to but still not working. can anybody help

  • @zromp1
    @zromp1 11 років тому

    can you refresh the page without using getting new data.

  • @crisperlawas2968
    @crisperlawas2968 6 років тому

    can I get js variable to php without submitting?

  • @fofomusic4125
    @fofomusic4125 7 років тому

    it works perfectly in my localhost...but I cant make it work with a remote Server
    how am I supposed to write the URL?

  • @moahmedbozgia9375
    @moahmedbozgia9375 6 років тому

    saved my day ! very helpful thank you

  • @trer1992
    @trer1992 10 років тому +2

    FUCK YES YOU FUCKING LEGEND YOU SAVED MY FUCKING LIFE AND IT WAS WITHIN THE FIRST MINUTE

  • @tylancoleman2862
    @tylancoleman2862 5 років тому

    How can I attache this form to an array?

  • @davidweiler8785
    @davidweiler8785 5 років тому

    is it possible to send html arrays to php?

  • @hiteshbatra7656
    @hiteshbatra7656 5 років тому

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

  • @HP-vo9gi
    @HP-vo9gi 8 років тому

    Woooooow. Life Saver! Thank you!

  • @AlexandreLimaCandido
    @AlexandreLimaCandido 12 років тому

    very nice tutorial... thank you for help me out !

  • @2003112329
    @2003112329 10 років тому

    very nice.. thanks dude.. 2 thumbs up

  • @santunu23
    @santunu23 10 років тому +2

    where should i find or download jquery.js file which one use in ur video plz advice thank u very much for ur video

    • @fuzzybuddy4457
      @fuzzybuddy4457 6 років тому

      you can just get the cdn at the jquery website or download jquery at the jquery website make sure to download it on your website folder

  • @saruultuul4658
    @saruultuul4658 9 років тому

    you saved my life :) thank you

  • @arslanahmadkhan
    @arslanahmadkhan 7 років тому

    i am facing a problem while ($.post) badgateway error 502 any help

  • @lagiator
    @lagiator 11 років тому

    thanks for this. it would be useful to post the code on the description using pastebin.

  • @manojbharti8603
    @manojbharti8603 6 років тому

    you are a legend dude

  • @gurroladesign
    @gurroladesign 11 років тому

    thanks for the tutorial... worked great!

  • @TheIsko29
    @TheIsko29 11 років тому

    Can i Connect this with DB ?

  • @AkaiKnight
    @AkaiKnight 10 років тому

    This was really helpful!

  • @sudonitin
    @sudonitin 5 років тому

    gives me error in php code, says undefined index postname, postage

  • @BielanCamiloNeres
    @BielanCamiloNeres 6 років тому

    very good, tks

  • @debraisgek
    @debraisgek 11 років тому

    Thanks man, you helped me a lot :D

  • @zainabal-bahadly6497
    @zainabal-bahadly6497 10 років тому

    You r so awesome man that helped me soooooooo much thanx alot :D

  • @virendrasinghbais9028
    @virendrasinghbais9028 8 років тому

    what if the script is not inside div tag?
    then what should i use instead of $('#result')

    • @BlauDroid
      @BlauDroid 8 років тому

      You can use something else like and it will work wherever you can't use div.

  • @w00tilicious
    @w00tilicious 10 років тому

    Thanks! Solved my problem!

  • @AlexNirmal
    @AlexNirmal 7 років тому

    Great help, thanks !

  • @HumayunKabirtorab
    @HumayunKabirtorab 7 років тому

    This video is helpful, thanks a lot.Please keep it up. (y)

  • @pilarrodriguez5082
    @pilarrodriguez5082 4 роки тому

    Thanks! :)

  • @markencarnado5568
    @markencarnado5568 8 років тому

    i wanna know if the page has reload or not?

    • @JustDraakje
      @JustDraakje 8 років тому

      no the page does not reload thats where ajax requests are used for
      but you sound new you should learn first how to create a post request

  • @somebodygenius6528
    @somebodygenius6528 9 років тому +1

    Not working, because I haven't file "jquery.js" and from where can I download it?

    • @rzaaeeff
      @rzaaeeff 9 років тому +1

      Just between and tags, paste it:
      (It's safest way, because it loads jQuery library from Google.)

    • @somebodygenius6528
      @somebodygenius6528 9 років тому

      Thank you for answer, I do that, but still does not working... Maybe something is wrong in code...

    • @rzaaeeff
      @rzaaeeff 9 років тому

      ვიღაც გენიოსი ,if you have website, it should work. If you use localhost, it still works if you have internet connection. But if you're completely offline, it won't help you, because it loads jQuery library from web : Google.

    • @unknownpersonofnointerest2743
      @unknownpersonofnointerest2743 6 років тому

      Heyder is correct. If you are not using an internet connection then you will need to visit JQuery's website and download the js file for it. Also make sure you changed the JQuery selector id's to match your elements

  • @MrGothicTruth
    @MrGothicTruth 5 років тому

    THANK YOU BRO!!!!!!!!!! THAAAAAAANKS!!!!!!!!!!!!!!!! :)

  • @betonmonster2012
    @betonmonster2012 3 роки тому

    nice job my pc crashed after using post method

  • @fuzzybuddy4457
    @fuzzybuddy4457 6 років тому

    could you please provide source code

  • @panagiotis9688
    @panagiotis9688 11 років тому

    Hi there, very nice tutorial, really helpful, but I get error message Notice: Undefined index: postname. Can you please help me on that.

  • @faisalu007
    @faisalu007 9 років тому

    Thank you very much.

  • @vparitorres
    @vparitorres 10 років тому

    Excelent.. thank you..

  • @1duducm
    @1duducm 3 роки тому

    THANKSSSSSSSSS

  • @royhonders
    @royhonders 9 років тому

    This one isn't working for me. Maybe you need to clear up exactly where you get the jquery file from. I'll use something else instead now.

  • @prajnahegde503
    @prajnahegde503 6 років тому

    Not able to execute the script

  • @tylancoleman2862
    @tylancoleman2862 5 років тому

    Thanks for this

  • @abell12
    @abell12  11 років тому

    Yes

  • @shawnbeans7389
    @shawnbeans7389 3 роки тому +1

    2021?

  • @jeanmoroko6085
    @jeanmoroko6085 8 років тому

    Nice, thk you...

  • @my_dixie_rect8865
    @my_dixie_rect8865 6 років тому

    Nice video

  • @sabmost
    @sabmost 4 роки тому

    pls send me the code

  • @SB-qm5wg
    @SB-qm5wg 4 роки тому

    Really hard to hear you.

  • @vatsalshah6505
    @vatsalshah6505 8 років тому +1

    nice one

  • @aussux255
    @aussux255 10 років тому +1

    Before you upload this video, please make sure what jquery is.

    • @affa8757
      @affa8757 10 років тому +7

      If you knew it so well, then get the fuck out of here, or else make your own tutorials if you know better.

  • @FreedomForKashmir
    @FreedomForKashmir 5 років тому

    increase sound

  • @dkolln
    @dkolln 10 років тому

    31 seconds for me. Had the jquery in place, just didn't import jquery into the system. NIce!

  • @veronicavasquez7355
    @veronicavasquez7355 10 років тому

    Thank you!!!

  • @SaedAgha
    @SaedAgha 11 років тому

    thanks alot man

  • @mtyrio
    @mtyrio 7 років тому

    Is't jQuery tutorial not a JavaScript...

  • @zoommair
    @zoommair 6 років тому

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

    • @Andre-rj9uf
      @Andre-rj9uf 5 років тому

      how would you do it then

  • @abell12
    @abell12  12 років тому

    No JavaScript must be enabled.

  • @romanagrimm1
    @romanagrimm1 11 років тому

    I like your voice

  • @hamadasaidi9202
    @hamadasaidi9202 6 років тому

    its jQuery Gandalf!

  • @MohammedIbrahim-hk2bp
    @MohammedIbrahim-hk2bp 2 роки тому

    I got it from you

  • @alifakhoury6763
    @alifakhoury6763 6 років тому

    Are you coding on a river?

  • @Vereonis
    @Vereonis 10 років тому +3

    wtf is "ju'quereeerrr"

    • @unknownpersonofnointerest2743
      @unknownpersonofnointerest2743 6 років тому

      j-Querer may be because he has a slight speech impediment. You have effectively used your ignorance to make hateful comments. It is better to keep your mouth shut and have people think you're a fool, than to open your mouth and remove all doubt. Shame on you and the 7 likes your comment got for picking on someone. You should stick to making videos on 'Dragon minimap bugs'. Especially since your video description makes no sense at all. The man did a great job and his 9K subscribers attests to that. Hopefully, your potential future employers will see this.

  • @sudhanshusingh1104
    @sudhanshusingh1104 5 років тому

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

  • @cloudzcrustgt6057
    @cloudzcrustgt6057 6 років тому

    L