Jump to content

Archived

This topic is now archived and is closed to further replies.

neylitalo

Resources

Recommended Posts

The Rico library - pre-build AJAX functionality. It's absolutely gorgeous. http://openrico.org/

http://www.phpfreaks.com/forums/index.php/topic,79168.0.html
http://www.ajaxprojects.com/

Share this post


Link to post
Share on other sites
Good resources.

While pre-build AJAX libraries/wrappers/frameworks whatever you call it, might be a nice thing - I wouldn't recommend them for people just starting out with AJAX. There's a couple of reasons for that.. one being that you don't get to understand how AJAX workes without writing the code yourself. Even if you're just writing the examples off a book word by word (as I tend to do), while doing that you learn what each function does and how they're named etc. it's good practise :D. For the user that knows all this, by all means use these libraries if it helps faster development.

Also some very nice AJAX/Javascript/PHP tutorials on this site: http://www.ajaxprojects.com/ and other goodies.

Share this post


Link to post
Share on other sites
Thanks for the comments.  I tend to agree with you that people should be writing their own code when they start out.  It helps to understand the client/server interaction and helps tremendously in the debugging process!

I'm going to copy your link into the opening post.

Share this post


Link to post
Share on other sites
You also might want to check my AJAX directory. It has 140 free scripts + more tutorials and other AJAX stuff.

http://freeajaxscripts.net

I welcome script submissions - absolutely free of charge.

Share this post


Link to post
Share on other sites
One thing I want to throw out there: Javascript (as I've tested in IE 6, Firefox, and Opera) has the funcions escape() and unescape() defined, meaning they are built-in functions. Therefore, you don't have to write your own encoding/decoding functions to make your GET/POST data url-safe.
Example:
[code]var title="The End";
var html="Hurrah!<br>And so it goes & goes! I ain't no sore, not @ the world no more. Url: \"index.php?page=etc&stuff=2\"";
url="index.php?page=etc&title="+escape(title)+"&html="+escape(html);[/code]
Nothing complicated about it.

Share this post


Link to post
Share on other sites
Here are few more reference

Simple Ajax: http://www.phpclasses.org/browse/package/2718.html

Ajax: http://rochakchauhan.com/blog/category/programming/ajax/

Share this post


Link to post
Share on other sites
Rasmus' 30 Second AJAX Tutorial.  One of the best I've read.

[url=http://marc.info/?l=php-general&m=112198633625636&w=2]http://marc.info/?l=php-general&m=112198633625636&w=2[/url]

Share this post


Link to post
Share on other sites

Keeping as backup for reference AJAX standard for quick uses.

 

/**
* @xmlHttp used to ajax handle
* --------------------------------------------
* Default STandard use
*/

var xmlHttp;

/**
* @ajax_maincall
* Call this from your HTML events
*/
function ajax_main(){
    // Create ajax
    ajax_connect(2,2,3,4);
    /* 
     * Start auto reload 
     * In case of real time data query
     * Optional
     */
    ajax_listen();
}

/**
* @GetXmlHttpObject used to detect the browser
* Supported - Firefox, Opera , Safari, IE
*
*/
function GetXmlHttpObject(){
  var xmlHttp=null;
  try{
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
  }catch (e){
    // Internet Explorer
    try{
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }catch (e){
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  return xmlHttp;
}

/**
* @ajax_connect
* Use query mysql data or other
* by php, asp, jsp
*/
function ajax_connect(str1, str2, str3, str4){
  // Set xmlHttp object for browser
  xmlHttp=GetXmlHttpObject();
  // Condition for browser
  if (xmlHttp==null){
    alert ("This browser does not support AJAX!");
    return;
  }
  /* 
   * Variable setup for php or asp or jsp
   */
  var url="username_password_others.php";
  url=url+"?str1="+str1+"&str2="+str2+"&q3="+str3+"&q4="+str4;
  // Must be used , dont change for caching
  url=url+"&sid="+Math.random();

  /* 
   * Call output event
   * Query output represent
   * *condition can be removed
   */
  if(str1=="2"){
      xmlHttp.onreadystatechange=ajax_dataarival1;
  }else{
    xmlHttp.onreadystatechange=ajax_dataarival2;
  }
  // Execute GET method
  xmlHttp.open("GET",url,true);
  // Send Get or Post method
  xmlHttp.send(null);
}

/**
* @ajax_dataarival1
* Login failure
*
*/
function ajax_dataarival1(){
  if (xmlHttp.readyState==4){
      // Will replace the mother page.
      // html: <div id="s1"> replace me </div> 
      $tim = time();
      document.getElementById("s1").innerHTML=$tim;
  }
}

/**
* @ajax_dataarival2
* Login failure
*
*/
function ajax_dataarival2(){
  if (xmlHttp.readyState==4){
      // Will replace the mother page.
      // html: <div id="s2"> replace me </div> 
      $tim = time();
      document.getElementById("s2").innerHTML=$tim;
  }
}

/**
* @ajax_listen
* Timer to ping and pong
* Optional timer
*/
var tImer;
function ajax_listen(){
    ajax_connect(1,2,3,4);  
    cOunter=cOunter+1;
    tImer=setTimeout("ajax_listen()",1000);
}

 

 

Share this post


Link to post
Share on other sites

Heres a site that I use thats pretty easy to understand

 

DynamicAjax.com

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.