2: How to load in data from a server using AJAX - Learn AJAX programming
HTML-код
- Опубликовано: 4 окт 2024
- How to load in data from a server using AJAX - Learn AJAX programming. In this lesson we will learn how to get content from other files on our server, and insert it into our web page without needing to refresh the browser.
Learn how to install a local server here: • 2: Installing A Local ...
--
mmtuts is a RUclips channel that focuses on teaching beginner and advanced courses in various multimedia related skills.
We plan to make tutorials available on programming, video production, animation, graphic design, and on software such as the Adobe Creative Cloud programs.
PHP for beginners is a how to series that teaches the PHP coding language to people who are just starting out learning programming. The course teaches how PHP scripting can be made easy and teaches how to build many apps such as a login system, a comment section, how to upload images, how to create users in a website, and much more. Creating dynamic websites with PHP is easy and should not be seen as otherwise, which is why we want to explain the language in a easy to understand way for beginners.
If you have suggestions on new courses, or specific lessons within existing courses you would like to see, then feel welcome to submit them in the comment section or in a private message. ALL suggestions will be seen, but not all will be replied to since we get quite a few every day.
dude if you keep making such great videos im gonna Stop going to university :D
Hehe thanks :)
yes they're brilliant! i love how you make them sooo simple as lots of tutorials expect you to know certain things beforehand and this slows down learning. have you thought about doing some game development tutorials?
*-don't do that bro-*
University is useless.
@@sangambk6053 haha
I would have to say this guys videos have been one of the greatest resources I have ever found. Dude is literally teaching me to code.
A beautiful Video. The best I have seen for ajax. Please keep on teaching like this. People like you make the difference for students like us
This is better than my university
your university teaches this?
A fellow BTS fan, I see :) Wouldn't disagree about the video, I wish my teachers explained like this.
Thank you dude! I've learned about web development because of you and got a job!!!
You should support him on Patreon.
Thanks for making this!! Honestly im paying A LOT of money to attend a bootcamp who like didn't go into detail with this..at all. no videos.. just long pages of text. I said what the heck... came here, got a much fuller grasp of AJAX in 12 minutes. Thanks.
Btw, I learned PHP from you last 2019, then I stopped. Still know how to but right now I'm going to learn Ajax from you. Thank you for that. :)
Thank you. That Facebook chat example was perfect for explaining AJAX.
Now it makes sense
Great teaching easy understandable words like bro, u made ajax the easyest for me love u bro....
I made a e-commerce system using your tutorial. thanks dude
this is the best AJAX tutorial in RUclips!
Very nice explanations. I definitely feel like you have a strong grasp on the subject matter. I enjoyed following along as I typed in the code on another computer. Thanks for the video!
i changed data.txt to result.php and it displayed the data from database which i programmed in my result.php page.. whoa it worked..!! thanks bro.. (y)
Thanks a lot Dan.
I had forgotten the # on the button, spent a lot of time wondering why it was all not working, but thanks GOD I noticed
Your videos are awesome simple explanation and easy to understand by everyone please keep making videos
This video still saving life in 2023, please do you have a platform where you sell completed courses with actual projects for OOP php projects
If only university professors explained things like this.
Great couple of videos on AJAX. Very easy to understand.
Good job! You are almost at my level skill
I bet you're very smart, little boy!
This is a nice example. What if I am trying to load data from a specific column of a database table?
Watching this video makes me more valuable to my employer(s) so I can ask for more econonomical compensation for my skills.. :) Can I make you a donation?
Another 'easy to understand' tutorial, thanks Daniel!
dude...make some videos for JSON....your videos are amzing...
Very high quality content sir, a million thanks and wish you well!
Thanks bro! Helps a lot, you made it look easy!
very good explanation ,
Wow you explain very well. Keep it up!
I cant download the files
You deserve more subscribers
i am you student from Uganda thank you
Great vids, but this one is not working anymore on Google Chrome, or explorer, or edge, only works on Firefox
Mmtuts University of RUclips
Thank you!
i got this error after adding the second parameter in the load functon: Failed to load resource: the server responded with a status of 405 (Method Not Allowed)
please help!
yeah its working perfect...
first ever best tutorial thanks
very good broh!just loved this vedio
Lots of love for you broo really appreciate your work
Thanks, I'm trying to make my own web page with memes (inspired by 9gag) and I want to add a comment section and upvote/downvote system of some sort. This seems like a good tutorial on how to do it.
Thank you so much, you're just amazing
The alert callback showed before the Ajax completed
(in the middle)
*I have a Problem*
_(index):32 Uncaught TypeError: $(...).load is not a function
at HTMLButtonElement. ((index):32)
at HTMLButtonElement.dispatch (jquery-3.2.1.slim.min.js:3)
at HTMLButtonElement.q.handle (jquery-3.2.1.slim.min.js:3)
(anonymous) @ (index):32
dispatch @ jquery-3.2.1.slim.min.js:3
q.handle @ jquery-3.2.1.slim.min.js:3_
How can I solve it?
you must use not slim. version
very good explaination. thanks a lot
Hey Dani,
Can you show how to insert data into database with ajax so page doesn't refresh?
is this jQuery classed as inline scripts?
When I click the button I get an error in the chrome console saying
Failed to load file:///C:/xampp/htdocs/data.txt: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
I dont understand how this is a cross origin request as both my index page and the data I want to load in are both in the same folder which is the htdocs folder (I am using XAMPP)
Please help!
Thanks but please am getting this error after doing everything you did:
Access to XMLHttpRequest at 'file:///opt/lampp/htdocs/AjaxProject/sample.txt' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
please help
Thanks!
Nice Tutorial sir, thank you very much
H. Is there a way to get server data as a js variabile, that can be used in functions with ajax, outside the function ? Thanks.
I need the data, for a form validation script, so i need a value returned.
awesome video ! really good. well explained, everything's good !
0:22 Dear Mr. Danial, AJAX can do work off-the-server as well. Because I have worked with AJAX without a localhost server in simple HTML file not PHP. There could be some browser problem because sometime Chrome does not support AJAX without Server but Firefox runs the AJAX queries easily without a server. Please search and make it correct. I have real example that AJAX can work without server but (in my case) only on Firefox.
I'm sitting here trying to run it directly from the filesystem in Chromium and having it silently fail. Not even a word from the developer console. I hate the fucking browser.
Would you just use Async/Await these days or is my thinking wrong?
Daniel... Today I feel a bit overwhelmed... Why is because the more I study the more names I hear... First it was HTML was all you needed... Then we learned that while that was true... The site looked crappy without CSS... Then we were excited when we learned to change background color, font color and size... Use a float and div.... Then we heard about the need for JavaScript if we wanted a job. After all, who can get a job with only HTML and CSS.... So we learned the basics of vanilla JS only to find out that we now need jquery.... Now we hear about the portfolio and we now need some backend to show we are able to do front end.... So we look into building a e commerce section only to find out we now need pho and my SQL..... Ahhhhhhhhhhhhhhhhhh!
😂 lol
So basically we need a video that touches on what these things do and a logical path to get some front and back end..
So what are all these things used for/good for... And in what order do we try to learn them and we need more projects I think
..
Not immediately but just throwing ideas out to you.
You have done an amazing job... And we are proud to call ourselves your students..
O and every time we think we know something like even HTML... We learn we don't know as much as we thought.... Variables in CSS.... Wow.... That's crazy..... This is a never ending journey I guess.
hi, i love your videos, do you have an i idea how long this series on AJAX will be?
Lesson files link is expired!!
how to fetch realtime data from terminal and show it in browser in real time someone please help me thanks in advance.
Hey first i want to thank you for this explanation, and i have just 1 question for you and i hope you answer me, the second data wish we send with the method load and $.post also, can we save it in our text file without php ?
Great work as always!
Hi dani
I Saw that you was using jquery, but Can i also Code Ajax with JavaScript, or do i need to use jquery
Hi. Good day im running a script of a setInterval function that loads a php file that queries to the server for every 2 seconds. and it returns a warning about web sockets protocol. but the query works fine and functional. Is it ok if i only hide all the warnings (eg. display_error: off in php.ini to hide all display errors)? i only use time interval for loading a notification and it used for a multiple client.
Thank you.
nice tutorial
hey Dani Krossing,
I want to know how to use AJAX when I want to submit a form to a PHP file, insert data into mysql database, and select all the data from database.
In addition, while I have multiple forms made (comment, username, submit, etc) under each data selected from mysql database, I want to fill out each individual forms and store different results back into the database with Jquery and AJAX without refreshing the page kind of like the same system as this comment section on youtube. Any help would be nice.
If you found out how to do this now after a year please let me know.
@@Andyyy7666 I figured out how to do it since I last sent that comment. However, I suppose the best way to explain this is if I send a video because it is quite difficult to explain in this comment. It nice to see after a year someone finally replying even though it not a solution😅
@@stephenokoduwa for the last 5 hours I’ve been sitting here and I actually just made an api and it works grate.
inside the callback function, would it be possible to run a function to hide a preloader once the ajax call is finished? would that be advisable or is there a better way?
Amazing Channel !! But Can you create any real time projects using UI development(html,css,php,js,sql) ??????
awsm work bro
hi im just asking how do i run AJAX do i need xampp .do you have a tutorial on how to do it
so the second parameter in the load method updates the txt file with the information written?🤔 Im learning about ajax now so this seems interesting.
I love you !
Do I have to download outside sources or can I make my own custom JQuery codes for Ajax?
I can only display alerts, but not change the text in the div.
thank u
download link is not working.
Ajax is a good program to learn
why the function doesn't work (the p doesn't change to the data.txt content) when I add the second parameter? The alert function is still executed but the p doesn't change if I add the second parameter
I'm a bit confused. I've tried loading the txt file but it didn't work. I thought it's something wrong with my code but it's exactly the same. To make sure that jquery works, I've changed load() to text() and inserted some text. It worked. So my problem is with loading the file. My code is exactly the same like in a video. File data.txt is located in a root directory. Any idea what went wrong?
Do we need t add some extra code when we need to use Ajax?
what happened to name and second name? Where did they go?
@mmtuts Yes really?
can you use ajax on google results webpage-not your own webpage? or is it protected?
just to get text results
Which IDU you used to develop this sample page?
can you send here the sql you use in filling the tables? i only practice in internet cafe so it takes a lot of time for me to set up all things i need to practice the ajax,
excellent you are
Thank you
Hello Sir ,it will be a lot help if you could show a crud Ajax mysqli php with a active /deactive button
GREAT TUT KEEP IT UUUUP ❤
Hello, is it possible to send javascript variable to MySQL? How can I do it? I would like to send javascript game score to database and print it on the same page in div results.
IT doesnt wiek i included the jQuery and adter Burton clock IT does nothing. Can Antoine help?
great,
but you should show this lessons without jquery!
only javascript
nooooooooo
Why use Javascript instead of jQuery when Javascript's use of AJAX is not consistent across different browsers. Don't code harder, code smarter Paltibenlaish. I only wish he used PDO instead of Mysqli for the same reasons. But he is a great help and teacher!
if i only had knew about Ajax a few weeks ago i could have passed my computer science class :(
thank you...
@mmtuts Nice Video but i am confuse with second parameter in load() , can anyone explain ?
do you have a new link for the lesson files?
Do you really need Jquery to do Ajax???
no, u can do it with javascript but it's easier with jquery, the drawback there i believe is if say for example you're only working on a small project and you have to load in the entire jquery library just for that single ajax call then in those cases it is better to use javascript instead to save memory i think, correct if i'm wrong i'm still pretty new but that is what i've read on stackoverflow at least
How can we reference to this 'data' which you are intializing?
I have been trying to use this programme for a django powered project. Although my call back function works, the document that needs to be downloaded is not being downloaded , so I am getting an alert due to the alert function but no additonal information. Does anyone have any ideas?
excellent!
Thank you!
Good tutorial, but why unnecessarily use jQuery for this? The default way of doing it is simple enough, and people want to learn AJAX here.
hello even i added the cdn on click of button it is not working what should i do
At 9:55 i do not get the point of including the name parts. What functions do they serve?
Let's take an example where I have a PHP file that gets a users information from a database. Then in order to get the correct user from the DB, I would need to tell the PHP file what the users username is (or some other information on the user). And we do that by including the information/data where we create the names :)
Ohhhh ok thanks for explaining it to me.
dude could you submit the exercise files once again? Many thanks
Is the load possible in chrome? I receive an Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https error. Edit ok got it. Works only on server