Hi frnds..

i need to know some ajax based small websites....
i mean website designed by using ajax with php....

Also send me some urls regarding ajax basics to learn ajax easily.. ....

Dani AI

Generated

requested small AJAX/PHP examples and basic resources; collected tutorials and pointed to real-world uses. Below is a concise, practical roadmap with a minimal example, common pitfalls, and modern pointers that remain relevant years later.

Start by splitting the work into three pieces: client-side request (XHR or Fetch), a PHP endpoint that returns JSON, and a DOM update step. Good starter projects are live search/typeahead, inline-edit with "save" via AJAX, async form submission, and a small CRUD admin panel that loads lists and saves records without full page reloads.

A minimal pattern (front end + PHP backend):

fetch('search.php?q=' + encodeURIComponent(term))
  .then(res => { if (!res.ok) throw new Error(res.statusText); return res.json(); })
  .then(items => {
    // render items into the page
  })
  .catch(err => console.error('AJAX error', err));
<?php
header('Content-Type: application/json; charset=utf-8');
$q = trim($_GET['q'] ?? '');
try {
  $pdo = new PDO('mysql:host=localhost;dbname=mydb;charset=utf8mb4','user','pass',[PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION]);
  $stmt = $pdo->prepare('SELECT id,title FROM items WHERE title LIKE ? LIMIT 10');
  $stmt->execute(["%{$q}%"]);
  echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC));
} catch (Exception $e) {
  http_response_code(500);
  echo json_encode(['error'=>'server error']);
}

Quick troubleshooting and cautions:

  • Check the Network tab: status codes, response body and headers.
  • Ensure Content-Type: application/json and that no PHP notices/HTML precede the JSON (disable display_errors in production).
  • Use prepared statements to avoid SQL injection and always validate server-side.
  • Watch CORS when calling cross-origin endpoints; set appropriate Access-Control headers.
  • Debounce frequent events (keystroke-based search) to reduce server load.

Modern reference reading: MDN's Fetch docs and the PHP manual on PDO/json_encode are concise and kept up to date. Prioritize progressive enhancement and server-side validation over JavaScript-only solutions.

Recommended Answers

All 2 Replies

Hi frnds..

i need to know some ajax based small websites....
i mean website designed by using ajax with php....

Also send me some urls regarding ajax basics to learn ajax easily.. ....

Correct me if I'm wrong but it looks like this forum uses Ajax for some of the functions.

Many websites use ajax. I also wrote many ajax-based functions for my own CMS that I am working on.

The registration, login form on the site uses ajax, some profile editing use ajax

Take a look at the web-based style editor I wrote using YUI library for front end and php/mysql on backend.

http://www.sharedlog.com/index.php?a=blog-settings

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.