Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

TutsPlus.com:
How to Use AJAX in PHP and jQuery
Jan 07, 2019 @ 17:40:40

The TutsPlus.com site has a new tutorial posted showing you how you can use PHP, jQuery and AJAX together to help make the overall user experience of your application better and more responsive.

Today, we’re going to explore the concept of AJAX with PHP. The AJAX technique helps you to improve your application's user interface and enhance the overall end user experience.

The post starts with an introduction to AJAX - what it is, how it's commonly used and how the normal requests flow. They then show how it works with normal "vanilla" Javascript (no jQuery) and how that compares to the jQuery version. It then dives into the real-world example script, showing how to create a form that sends login information to the backend for evaluation via a POST request.

tagged: ajax tutorial jquery login form introduction

Link: https://code.tutsplus.com/tutorials/how-to-use-ajax-in-php-and-jquery--cms-32494

CloudWays Blog:
Create Live Search In Laravel Using AJAX
Dec 07, 2017 @ 18:55:08

The Cloudways blog has posted a new tutorial for the Laravel users out there showing you how to create a "live search" box for the contents of your site. They use an e-commerce example and make use of some simple Javascript to return results from a backend script.

Whether you have a blog or an ecommerce store, a search bar is always an essential component of the UI. However, the days of simple search bar is over. These days, a live search bar is much more efficient than a simple search bar because it displays similar content in real time. This increases the chance of landing a sale because the customer could see the largest selection of related products.

The article starts off with the prerequisites for following along including an installation of PHP, MySQL, Apache and Laravel. They include an optional step of setting it all up on a Cloudways server but this isn't required if you want to do it locally. The tutorial then walks through the setup steps and creating the migration for the "products" table it will search. It also shows the creation of the controller and routes for the search endpoints and the view with the Javascript to make the Ajax request. It finishes with a way to test the result and a screenshot of what should be returned.

tagged: live search laravel tutorial ajax request ecommerce

Link: https://www.cloudways.com/blog/live-search-laravel-ajax/

SitePoint PHP Blog:
Laravel Dusk – Intuitive and Easy Browser Testing for All!
Feb 23, 2017 @ 18:54:06

On the SitePoint PHP blog there's a tutorial posted that introduces you to Laravel Dusk, a browser-based testing tool, and how it can be used to test a Laravel-based application.

End to end testing for JavaScript applications, particularly single-page-apps, has always been a challenge. To that end, Laravel released its 5.4 version recently with a new testing library: Dusk.

With the release of Dusk, Laravel hopes to give its users a common API for browser testing. It ships with the default ChromeDriver, and if we need support for other browsers, we can use Selenium. It will still have this common testing API to cater to our needs.

The tutorial then walks you through the installation process and two approaches to getting it integrated into your application. They then create a first test, checking to see if a user can log in successfully. They also include how it looks when a test fails and the screenshot that's taken just before the failure. It also covers the testing of Ajax-related calls, inserting a delay when a button is clicked to wait for the response. Finally, the tutorial shows a more advanced example involving a popup modal, a form and multiple interactions.

tagged: laravel dusk browser testing tutorial introduction ajax example

Link: https://www.sitepoint.com/laravel-dusk-intuitive-and-easy-browser-testing-for-all/

TutsPlus.com:
Building Your Startup: Ajax for Meeting Times and Places
Jan 02, 2017 @ 19:10:42

The TutsPlus.com site has posted the next in their "Building Your Startup" series of tutorials covering the use of Yii2 to create a calendaring application. In this new part of the series they continue migrating some functionality over to use an Ajax-powered system, reducing the need for page reloads.

Last week, I delved deeper into Ajax to transform the meeting scheduling experience into a fully ajaxified model and eliminated the need for page refreshes. I got about halfway, focusing mostly on the straightforward elements.

In today's tutorial, I'll guide you through the more complex content panels that required a lot more troubleshooting, research, debugging, brainstorming, and recoding. [...] I'm also going to show you how I used Google's Chrome browser developer console to help me identify the broken areas—which can be especially difficult when working with Ajax between PHP and JavaScript. It's like light at the end of the tunnel of darkness.

The tutorial then walks through the updates needed to move over various pieces of functionality to the Ajax-driven model:

  • adding meeting participants
  • adding dates and times
  • adding meeting places

There's also a few screenshots included of the Chrome developer console and what some of the example request/responses look like, helping you debug your own development work.

tagged: startup ajax meeting time place series refactor feature tutorial

Link: https://code.tutsplus.com/tutorials/building-your-startup-ajax-for-meeting-times-and-places--cms-27327

TutsPlus.com:
Programming With Yii2: Using Ajax
Nov 10, 2016 @ 17:18:23

The TutsPlus.com site continues their series covering development with the Yii2 framework in this new article. This time they're focusing in on only the Ajax functionality using it an an example for their startup application interacting with Google Maps to place meeting locations.

In this Programming With Yii2 series, I'm guiding readers in use of the Yii2 Framework for PHP. In this tutorial, we'll explore the implementation of interactive pages using Ajax. Specifically, I'm going to highlight the use of Ajax in two areas of the Meeting Planner application, which I'm writing the Building Your Startup series about in parallel.

The article then starts in on showing you how to load a Google Map into the page using some of the built-in Ajax handling and integrating it into the "Create a Place" form. They show how to collect the information from the map once a location is selected and use this to update a "meeting" record on the backend. All coded needed to reproduce the system is included.

tagged: ajax yii2 framework programming tutorial series google map

Link: https://code.tutsplus.com/tutorials/programming-with-yii2-using-ajax--cms-26663

SitePoint PHP Blog:
Pagination with jQuery, AJAX and PHP
May 28, 2015 @ 14:46:57

The SitePoint PHP blog has a new tutorial posted showing you how to set up pagination with jQuery and PHP using a simple Silex-based application.

n this article, we’re going to explain how easy it is to paginate your data set using PHP and AJAX via jQuery. We’re also going to use the Silex framework for simplicity.

The data he's going to paginate through is a list of "people" data with ID, name and age values. He starts by helping you get Silex installed and a new project created. With that in place, he shows how to inject the database connection (PDO) into the application and set up the simple route to output the "people" data back to the waiting Javascript. The route includes a page number value that's used in the LIMIT statement to segment the results into pages. He also includes another route that returns a total count of people records so the pagination knows when to end. With the backend in place, he then moves to the frontend, showing the complete code to get the page records and populate them into the page (via a list).

tagged: pagination tutorial ajax jquery silex people data

Link: http://www.sitepoint.com/pagination-jquery-ajax-php/

SitePoint PHP Blog:
PHP Streaming and Output Buffering Explained
Sep 04, 2014 @ 15:17:44

The SitePoint PHP blog has a new performance-related post to the site today from Imran Latif. This new post looks at effective use of output buffering and streaming and explains how it works and some examples of its use.

As a PHP developer, I was wondering whether we can have something similar [to Streaming in Rails] in our favorite language? The answer is yes – we can easily have streaming in PHP applications with little effort, but in order to get this right we have to become familiar with some underlying concepts. In this article, we will see what streaming is, what output_buffering is and how to get our desired result under different webservers (Apache, Nginx) and PHP configurations (CGI, mod_php, FastCGI).

He starts off with a comparison of the two different methods, streaming and output buffering, and how they behave in the output of content. He then gets into some simple examples with PHP with various methods: a simple delay, chunking up output and finally using the actual output buffering handling PHP offers. He also includes an example of streaming content over an Ajax request with a simple test using the sleep function.

tagged: streaming output buffering tutorial introduction beginner ajax

Link: http://www.sitepoint.com/php-streaming-output-buffering-explained/

NetTuts.com:
More Tips for Best Practices in WordPress Development
Jul 25, 2014 @ 14:18:09

NetTuts.com has published a few more WordPress tips and best practices to help you get the most out of your WordPress-based application.

Welcome to the second part of the series. In the first article, we explained the WordPress Coding Standards, how to avoid namespaces collisions, comments in the code, and some basic security tips. Today, we are going to go a bit deeper and write some more code and learn some techniques to improve performance and security of our plugins.

They look specifically at when you should include your scripts and styles, formatting Ajax calls and working with filters and actions. Code snippets are included with each point with links to some other resources for some of the topics to provide more information.

tagged: wordpress bestpractices development ajax scripts styles filters actions

Link: http://code.tutsplus.com/articles/more-tips-for-best-practices-in-wordpress-development--cms-21013

David Müller:
Cross Domain AJAX Guide
Dec 10, 2012 @ 18:17:39

In his latest post David Müller covers some of the things to consider when working with cross-domain ajax requests including CORS and iframes.

As it is widely known, AJAX Requests are only possible if port, protocol and domain of sender and receiver are equal. [...] Having this cleared out, we will cover ways around this restriction.

He covers three main approaches to allowing these cross-domain requests (and some of the security implications that can come with them):

  • CORS (Cross Origin Resource Sharing)
  • JSONP (Javascript with a local domain callback)
  • Iframes

He also briefly mentions things like window.postMessage (HTML5) and the use of a backend script to proxy a request into your application's local code.

tagged: crossdomain ajax cors iframe jsonp tutorial introduction

Link:

DZone.com:
PHP Ajax Cookbook (Book Review)
Apr 17, 2012 @ 18:03:50

On Dzone.com there's a book review from Ivan Ilijasic covering a recently released title from Packt Publishing, the "PHP Ajax Cookbook" (by Milan Sedliak, Rajesh Jeba R. Anbiah and Roshan Bhattarai). His review gives a "one minute bottom line" about the book and its contents.

I've been in PHP development for more than 10 years and this book is really useful material. I could recommend it to beginners and experienced developers. From my point of view, there are three types of developer books - complete byte-to-byte fat books, introduction books and cookbooks. I want my cookbook to have useful and simple to use recipes. This book fulfilled my expectations.

He mentions some of the topics that the book covers including javascript libraries and frameworks (mostly jQuery) and recipes for things like form validation, dynamic content, pagination and drag and drop functionality. He also points out some coverage of testing and debugging content as well as web service "mashups" and mobile app development.

tagged: book review ajax cookbook packt

Link:


Trending Topics: