Hey friends, I am trying to show database column data in my edit form of a Laravel project. yesterday I failed to show data from database in a select list using ajax. so let’s see the below blade file and ajax also to get your solution.
It is a web development technique that helps to create a highly responsive website. by the use of AJAX, we get desktop-like software experience on the web browser. It is used in the web pages to be updated asynchronously by changing data with a web server behind the scene (in the background). This makes it possible to update parts of a web page, without reloading the whole page. It is the use of the XMLHttpRequest object to communicate with server-side scripts.
The easiest way of implementing AJAX, especially if we’re planning on communicating with servers is by using jQuery.
Most people get confused with the concept that ajax is a programming language. So, let’s be very clear that
Why use AJAX
A whole page reload is not required on each request made.
Sends and receives data in the background.
Improves speed and performance.
Provides a better user experience.
How AJAX works
Ajax uses XMLHttpRequest object (also called XHR objects) to achieve this
Then the HTTP Request is made to the server by XMLHttpRequest object.
Then the server interacts with the database using the JSP, PHP, Servlet, ASP.net, etc.
When there is a match for the request then the Data is retrieved from the database.
Then the Server sends XML data or JSON data to the XMLHttpRequest callback function.
Finally, when all the things are good to go then the web-page made (with HTML and CSS) is displayed on the browser.