News Feed
Jobs Feed
Sections




News Archive
feed this:

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

David Müller:
Cross Domain AJAX Guide
December 10, 2012 @ 12: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.

0 comments voice your opinion now!
crossdomain ajax cors iframe jsonp tutorial introduction


DZone.com:
PHP Ajax Cookbook (Book Review)
April 17, 2012 @ 13: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.

0 comments voice your opinion now!
book review ajax cookbook packt


NetTuts.com:
Build Ajax Data Grids with CodeIgniter and jQuery
September 23, 2011 @ 12:23:59

In a new tutorial from NetTuts.com today they show you how to combine a CodeIgniter-based backend and a jQuery frontend to make a simple Ajax data grid of data pulled from a database.

In this lesson, we will create a CodeIgniter library that allows us to generate data grids automatically for managing any database table. I'll explain each step required to create this class; so you'll likely learn some new OOP techniques/concepts in the process! As a bonus, we'll proceed to write some jQuery code that will enable a user to update the data grid's content without having to wait for a page refresh.

The tutorial's broken up into a few different steps, each complete with descriptions and plenty of code ready for cut-and-paste:

  • Build a Data Grid Generator Class (a helper in PHP)
  • Testing the Datagrid Helper Class with a CodeIgniter Controller
  • Implementing Ajax (jQuery to the Rescue!)
  • Check All or Nothing!

You can also download the source for all of the scripts if you'd like to dive right into the code.

0 comments voice your opinion now!
data grid ajax jquery codeigniter framework tutorial


NetTuts.com:
How to Upload Files with CodeIgniter and AJAX
September 12, 2011 @ 12:03:27

New from NetTuts.com today there's a tutorial for those using the CodeIgniter framework for their application. It shows how to upload files with Ajax and a simple form (with jQuery and AjaxFileUpload).

Uploading files asnychronously can be a pain at the best of times, but when coupled with CodeIgniter, it can be a particularly frustrating experience. I finally found a way that not only works consistently, but keeps to the MVC pattern.

They help you create a database table to store the file information in (filename and title), make the controller to handle the request and build the view (with the form). Also included is the javascript you'll need to get the AjaxFileUpload script working for your file upload field. They extend the controller to handle the file upload and make a model to handle the upload and fetching of file information. The tutorial is finished off with a simple "delete" action to remove any file that's been uploaded.

0 comments voice your opinion now!
tutorial ajax upload codeigniter framework


Tutorialzine.com:
AJAX-enabled Sticky Notes With PHP & jQuery
August 31, 2011 @ 10:16:35

On the Tutorialzine.com site there's an interesting (though a bit older) tutorial showing you how to combine jQuery, PHP and some CSS+HTML to make a simple sticky note application complete with multiple note support and drag-and-drop abilities.

Today we are making an AJAX-enabled Sticky Note management system. It will give visitors the ability to create notes with a live preview, and move them around on the screen. Every movement is going to be sent to the back-end via AJAX and saved in the database.

They use the fancybox plugin for jQuery to make creating the notes a lot simpler. Included in the tutorial is all of the HTML, CSS, javascript and PHP you'll need to create the application (as well as plenty of description along the way). You can see a demo of it in action here or just download the source and dive right in.

0 comments voice your opinion now!
tutorial ajax sticky note jquery fancybox plugin


Joris de Wit's Blog:
Extending different layouts for Ajax requests in Twig, Symfony2
August 29, 2011 @ 11:39:34

Joris de Wit has a (very) quick post about a handy tip he found about switching layouts easily with Twig in his Symfony2-based application - a handy ternary sort of switch that can detect when something's an Ajax request.

I just learned about the 'app' global variable in twig. It's very handy for loading a special layout for ajax requests.

The "app" variable allows you get get back at some of the settings of your application and check on special things like the isXMLHttpRequest in his example. For more information about Twig and how you can add it to your application, check out Twig-Project.org. Using it's as simple as adding a phar.

0 comments voice your opinion now!
twig symfony2 layout switch template ajax request


David Stockton's Blog:
Changing ErrorController to work with AJAX
August 12, 2011 @ 08:58:06

David Stockton has a new tutorial posted to his blog - a technique he's found useful in his Zend Framework application to make the ErrorController work with Ajax calls to reduce the message you get back to just a JSON response.

If you've ever built a Zend Framework MVC app which makes AJAX calls, you may have noticed that if an error occurs, you'll get a chunk of JSON followed by the HTML for the error page. If you've built a layout, you'll get all of that back to. This is fine if your users hit the page in the browser but it can cause problems with your JavaScript being able to correctly decode your JSON.

The fix is pretty simple, though, and only requires that you add the error handling action to the Ajax context to force it to drop the layout and any other HTML that might come along with the view. He includes a bit more code to have the error handler include the exceptions and pass them out to be included in the JSON response.

0 comments voice your opinion now!
zendframework error handler controller ajax response exception


Gonzalo Ayuso's Blog:
Populating datagrid techniques with PHP
July 19, 2011 @ 09:25:46

In a new post to his blog Gonzalo Ayuso looks at the code required to populate a jQuery data grid with the records as pulled from a (MySQL) database.

Today I want to speak about populating datagrid techniques with PHP. At least in my daily work datagrids and tabular data are very common, because of that I want to show two different techniques when populating datagrids with data from our database. Maybe it's obvious, but I want to show the differences.

He uses "old school spaghetti code" rather than a framework to keep things simple and pulls the data from the database with a PDO connection. This information is then manually pushed into an HTML table and the data grid functionality is applied to it. The other method involves a little bit of JSON magic that the data grid library pulls in and populates for you, still appending rows to a table.

He notes that the second method seems faster to the user since the page and table are rendered first, but it also comes at the cost of more than one HTTP request.

0 comments voice your opinion now!
datagrid jquery technique preload ajax json


Shameer Chamal's Blog:
Tutorial Simple ajax validation for Kohana
May 24, 2011 @ 11:53:17

Shameer Chamal has a quick tutorial posted to his blog today showing how you can create a basic ajax validation feature for your Kohana-based web application.

If you are new to Kohana framework, implementing validation will be an adventure, especially if you are looking for ajax validation. In this article I will present a simple way to implement some necessary validations using ajax in a sign up form.

He starts with a simple view containing the login form and including a few extra files (like the Javascript helper for the validation). Next he creates the user model that will do the backend check to see if the user already exists. Finally the controller and Javascript are created to bring all the pieces together. The Javascript uses the jQuery framework to make things a bit more convenient and runs a check against the backend for the given username with the response returned as a JSON message.

0 comments voice your opinion now!
tutorail ajax validation kohana framework jquery


Freeaqingme's Blog:
PHP, JS & Service layers Blend like never before
March 17, 2011 @ 11:41:42

On his Tweakblog today Freeaqingme has posted about some work he's done linking Javascript to a PHP service layer and overcoming some of the performance issues he came across.

The past week I've been only programming (clientside) Javascript, and last night I finally got to tying it all to the serverside app, which is written in PHP. While adding some functionality to my Service Layer, it came to mind how much slower this process was in the past. [...] One of the nice things of Service Layers and performing your Access Control there, is that you can have multiple points of entry. So, to lessen the amount of tediousness, one can simply use one controller for all service requests coming from the client.

He was connecting to two via a XMLHttpRequest to a custom URL that would return a different result based on the kind of request. Internal routing handled the request correctly and the result from the view was pushed directly back to the client. He includes code to illustrate - a bit of PHP based on the Zend Framework structure, the Javascript to make the request and an example of invoking the service on the client side.

0 comments voice your opinion now!
javascrupt tutorial servicelayer ajax xmlhttprequest



Community Events











Don't see your event here?
Let us know!


security component language package release application podcast hack database performance opinion hhvm series introduction symfony2 facebook composer framework unittest install

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework