• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
seegatesite header

Seegatesite.com

Seegatesite.com - Programming Tutorial , Sharing , How and Learn Together

  • TOOLS
    • Bootstrap Navbar Online Generator
    • Customize Sidebar Menu Bootstrap 3
    • Bootstrap Demo
  • ADVERTISE
  • CATEGORIES
    • Android
    • Blogging Tips
    • Database
    • CSS
    • Info Gadget
    • Javascript
    • Linux
    • PHP
    • Various
    • WordPress
  • Q&A
  • PHP
  • JAVASCRIPT
  • JQUERY
  • ANGULAR
  • WORDPRESS
  • SEO
  • REACT
🏠 » PHP » Web Applications as Desktop Flavor with Ajax Agent

Web Applications as Desktop Flavor with Ajax Agent

By Sigit Prasetya Nugroho ∙ October 11, 2014 ∙ PHP ∙ Leave a Comment

Share : TwitterFacebookTelegramWhatsapp

With ajax agent, transfer data between the browser and the web server (HTTP request) occurs asynchronously. This is what allows a web page to request a small amount of data from the server without reloading the entire Web page.

how to use ajax agent with javascript and php

Ajax usability in a web, is an important thing. Why so, because in ajax there are many advantages, for example, you may often see a website which if clicked on a particular button or link, the web page is not switched to the new page, but rather only partial pages are changed, it was called ajax, ajax function which is called partial page of a website so that the website can be accessed quickly.

With ajax agent techniques we can develop web applications fast and responsive as well as desktop applications. The web applications have characteristics such as desktop applications are often referred to as Rich Internet Application (RIA).

Related Articles :

  • How To Use Select2 Remote AJAX With Example in JQuery, PHP And MySQL
  • How To Make Web Push Notifications in PHP, JQuery , AJAX And Mysql

Table of Contents

  • 1  Using ajax agent class to connect javascript with php function 
    • 1.1  Example use ajax agent in case : 

 Using ajax agent class to connect javascript with php function 

Ajax Agent Class is a very easy to use, yet very powerful open source framework for rapidly building AJAX or Rich Internet Applications (RIA). It is based on JSON & hence supports complex data types like associated arrays & objects.Aims to make Ajax work as simple as possible. Based on KISS (keep it simple stupid)

There are three steps to get started with the ajax agent :

1
2
3
4
5
6
7
8
9
10
11
<?php
include_once('agent.php'); /*reload ajax agent class*/
$agent->init(); /* initialize the agent framework & instantiate the server side */
?>
<script>
function javascript(){
agent.call('php_file','php_function', 'client_callback', param1, param2, ... etc); /* call php function from javascript browser */ }
function client_callback(value){
alert(value);
}
</script>

 Example use ajax agent in case : 

1. Create php file as index.php and copy code below to your file :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
include_once('agent.php');
$agent->init();
?>
<html>
<script >
function myname()
{
  var name=document.getElementById('name').value;
  agent.call('functions.php','myname_function', 'client_callback', name);
  return false;
}
function client_callback(value)
{
  document.getElementById('result').innerHTML=value;
  return false;
}
</script>
<body>
<label>Text your name here : </label><input type="text" id="name" />
<button onclick="myname();">Click Me</button>
<span id="result"></span>
</body>
</html>

2. Copy Agent.php on the same folder with index.php, you can download ajax agent < a href=”https://seegatesite.com/wp-content/uploads/2014/10/ajaxagent-0.4.tar.gz” title=”ajax agent download” alt=”ajax agent download”> here
3. Create functions.php file on the same folder with index.php and copy this script below

1
2
3
4
5
6
<?php
  function myname_function($name){
    $retval= 'Hello, my name is '.$name;
    return $retval;
}
?>

I hope it can help you to create web application as desktop flavor with ajax agent. I implement ajax agent on my tools to amazon asin grabber, amazon scraper product,etc.. please visit https://seegatesite.com/tools/ to demo site

Another PHP Related Post :

  • Tutorial Create Simple POS Using ReactJS And Laravel Lumen Part 1
  • How To Replace String With Another String In PHP
  • Login Page – Tutorial CRUD Client and API Server Using JQuery And Lumen Part 2
  • Tutorial CRUD Client and API Server Using JQuery And Lumen Part 1
  • How To Solve Problems Illegal mix of collations (latin1_swedish_ci,IMPLICIT) In Laravel
  • How To Resolve No ‘Access-Control-Allow-Origin’ Header In Lumen

Avatar for Sigit Prasetya Nugroho

About Sigit Prasetya Nugroho

This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Welcome to my Home,

Avatar for Sigit Prasetya NugrohoThis site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.



Popular Articles

Checked checkbox AdminLTE Bootstrap in Jquery

November 4, 2014 By Sigit Prasetya Nugroho 7 Comments

Simple create date format validation with jqueryUI

December 21, 2014 By Sigit Prasetya Nugroho Leave a Comment

Create Simple Progress Bar for Fake Online Generator with Jquery

January 10, 2015 By Sigit Prasetya Nugroho Leave a Comment

22+ Coolest Free Jquery Plugin For Premium Theme

October 3, 2015 By Sigit Prasetya Nugroho Leave a Comment

Easy Build Your Anti Copy Paste Plugin

October 6, 2015 By Sigit Prasetya Nugroho Leave a Comment

Popular Tags

adminlte (15) adsense (13) adsense tips (4) affiliate amazon (13) amazon (12) Android (8) angular (16) angular 4 (12) angular 5 (4) asin grabber (3) Bootstrap (27) codeigniter (5) create wordpress theme (5) crud (8) css (6) free wordpress theme (7) google adsense (4) imacros (4) increase traffic (6) jquery (34) laravel (10) laravel 5 (5) learn android (5) lumen api (4) modal dialog (5) mysql (6) nodeJs (4) optimize seo (4) pdo (6) php (30) plugin (53) pos (8) Publisher Tips (5) react (6) Reactjs (9) SEO (37) theme (17) tutorial angular (5) tutorial angular 4 (6) tutorial javascript (10) tutorial javascript beginners (4) twitter (3) wordpress (18) wordpress plugin (13) XMLRPC (5)




  • About
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Terms and Conditions

©2022 Seegatesite.com