Results 1 to 13 of 13
  1. #1

    Anyone think they will never master AJAX?

    It sucks that so many good paying PHP jobs in my city yet you have to have experience with Javascript and AJAX. I tried reading books on them but I just suck and do not think I can ever memorize all of those functions. I easily memorized most PHP, mysql, HTML, and CSS which is capable of creating any site, but the fancy crap like flash and AJAX I do not think I will ever understand.

  2. #2
    Join Date
    Sep 2006
    Location
    Cardiff - United Kingdom
    Posts
    1,569
    How complex are the books you are looking at? It always helps to start at the very start and go from there (seems obvious, but I've got one "beginner" PHP book which is quite complicated from the start - luckily I read the reviews and so purchased this more as an "intermediate" book)

    Try and find a really basic AJAX article online. That's what I did. I know understand the basics and if I ever wanted (which I don't at the moment), I could build up from there.

    It sure isn't easy though. You need a good, solid understanding of JS before going on. Once you can understand how the JS end functions, it's not too hard (all the PHP bit does is get the data via the $_GET vars, process them, and output back).
    Plagiarism Guard - Protect Against Content Theft
    Tristan Perry - Personal blog

  3. #3
    Yeah I searched Amazon for beginner books but they always start out with an example that a 3 year old can understand then suddenly jump to 200 line examples without explaining what the purpose of the functions are.

  4. #4
    Join Date
    Sep 2006
    Location
    Cardiff - United Kingdom
    Posts
    1,569
    Okay I see what you mean. To be honest my level of AJAX isn't too high (probably around a 4 year old level ), I guess it's just about searching around online to find an article that explains AJAX in a lot of depth and going from there.

    It's really not easy though, higher level AJAX confuses me a lot (whilst I'm quite happy with higher level PHP and all)
    Plagiarism Guard - Protect Against Content Theft
    Tristan Perry - Personal blog

  5. #5
    Join Date
    Apr 2009
    Location
    USA / UK
    Posts
    4,577
    I know I'll never master all of JavaScript and AJAX.

    To prove it I will now share with you my complete AJAX knowledge:

    The function library:

    Code:
    /* ajax.js
     * uses javascript to seamlessly 
     * request another page from an 
     * existing page without refresh.
     * takes a url to get and an element id
     * the get must be under the same domain 
     * as the page for security reasons.
     * If ajax doesn't work, the 'get' is 
     * put in the page as a simple "click here" 
     * link, unless innerHTML doesn't work, in 
     * which case the requesting page won't change.
     * This function is one-liner safe :)
    */
    function ajax(get,divid)
    {
    	var xmlHttp;
    	try
    	{
    		/* Firefox, Opera 8.0+, Safari */
    		xmlHttp=new XMLHttpRequest();
    	}
    	catch(e)
    	{
    		/* Internet Explorer */
    		try
    		{
    			/* Internet Explorer 6.0+ */
    			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    		}
    		catch(e)
    		{
    			try
    			{
    				/* Internet Explorer 5.5+ */
    				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    			}
    			catch(e)
    			{
    document.getElementById(divid).innerHTML='<a href="'+get+'">Click Here</a>';
    				return false;
    			}
    		}
    	}
    	
    	xmlHttp.onreadystatechange=function()
    	{
    		if(xmlHttp.readyState==4)
    		{
    			document.getElementById(divid).innerHTML=xmlHttp.responseText;
    		}
    	};
    	xmlHttp.open('GET',get,true);
    	xmlHttp.send(null);
    }
    And the example usage:

    Code:
    <div id="ajaxy">some default stuff here</div>
    <script type="text/javascript">ajax('/url/to/include.html','ajaxy');</script>
    It doesn't get much easier than that A replacement for the now-obsolete <IFRAME> tag.
    RAM Host -- USA Premium & Budget Linux Hosting
    █ Featuring Powerful cPanel Shared Hosting
    █ & Premium Virtual Dedicated Servers
    Follow us on Twitter

  6. #6
    Join Date
    Apr 2009
    Location
    Pittsburgh, Pennsylvania
    Posts
    583
    Look at a couple of the ajax frameworks.. pick one.. learn it.

    http://www.prototypejs.org/
    http://mootools.net/
    http://jquery.com/

  7. #7
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    66
    I'd recommend prototype.. you don't need to memorize hundreds of functions, just one:
    Ajax.Updater('divname','/url',{optional arguments});

    Easy.. If you're finding AJAX hard, you're probably doing it wrong. It's really not.

  8. #8
    I'll never master it, its evolving to quickly

  9. #9
    Join Date
    Apr 2009
    Location
    Pittsburgh, Pennsylvania
    Posts
    583
    I personally prefer jquery.. but i would honestly look at multiple and chose one for your taste. It's not hard to learn, just a little reading and patience.

  10. #10
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    66
    To be honest JQuery definitely seems to be the way a lot of people are going these days - it's definitely on my to-learn list. Either way the important point is to pick a framework and learn it - once you do AJAX all starts to seem very easy - in some cases even easier than doing things the old-fashioned way.

  11. #11
    Join Date
    Jan 2008
    Location
    St. John's, NL
    Posts
    2,201
    I've stayed away from AJAX as much as possible, as it seems to be one hack after another (then again, JavaScript is a hack in and of itself it seems).
    Cpanel/WHM • PHP • Perl • Ruby • Full Time Support
    LCWSoft - Canada web hosting (based in Newfoundland) since 2007
    Servers based in the US and Canada (Uptime Report)

  12. #12
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    66
    larwilliams: that's the benefit of using a framework like JQuery or Prototype; they do all the hacking for you, leaving you to write lovely clean code. I hate a hack as much as the next programmer and I used to hate Javascript for exactly that reason, but then I learned prototype and realised that modern Javascript programmers don't do hacks anymore. The only hacks I've done recently have been CSS hacks for IE6, and that's something you have to do whether you use JS or not.

  13. #13
    Join Date
    Jan 2008
    Location
    St. John's, NL
    Posts
    2,201
    Quote Originally Posted by kieransimkin View Post
    larwilliams: that's the benefit of using a framework like JQuery or Prototype; they do all the hacking for you, leaving you to write lovely clean code. I hate a hack as much as the next programmer and I used to hate Javascript for exactly that reason, but then I learned prototype and realised that modern Javascript programmers don't do hacks anymore. The only hacks I've done recently have been CSS hacks for IE6, and that's something you have to do whether you use JS or not.
    Thanks for the info. I hate IE css hacks as well
    Cpanel/WHM • PHP • Perl • Ruby • Full Time Support
    LCWSoft - Canada web hosting (based in Newfoundland) since 2007
    Servers based in the US and Canada (Uptime Report)

Similar Threads

  1. MinTyro - Cheap Cpanel, WHM, Master Reseller, Alpha Master Reseller
    By shuga808 in forum Reseller Hosting Offers
    Replies: 3
    Last Post: 07-11-2009, 05:28 AM
  2. Replies: 0
    Last Post: 06-26-2009, 08:26 PM
  3. Need ASP.NET AJAX SQL
    By daniel76 in forum Web Hosting
    Replies: 10
    Last Post: 10-09-2008, 09:55 PM
  4. Using Ajax and PHP?
    By wayiran in forum Programming Discussion
    Replies: 4
    Last Post: 07-19-2006, 11:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •