Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 9 of 9

Thread: AJAX tutorials

  1. #1
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default AJAX tutorials

    I want to put together some useful AJAX functions for use with my scripts without just copying code. I want to learn how the request object works so I can customize things to my needs.

    Does anyone know of any good tutorials? I want to be able to do things like submitting forms and checking usernames without page loads without code copying.

    Tim



    i used to be NintendoNews. visit my blog or add me on twitter.
    need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!


    "I am the way, the truth, and the life. No one comes to the Father except through me"
    John 14:6 (NIV)


  2. #2
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    script.aculo.us is amazing for doing stuff like this.

    Download that.

  3. #3
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Dentafrice, View Post
    script.aculo.us is amazing for doing stuff like this.

    Download that.
    I've used s.a.us, but I'd like a smaller more dedicated script really I don't need all the features of it in most cases. However, I don't mind using it. Have you got any links to good pages explaining how to use Scriptaculous in conjunction with forms?

    Also, anyone got tutorials without using a library? (such as s.a.us and jQuery)



    i used to be NintendoNews. visit my blog or add me on twitter.
    need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!


    "I am the way, the truth, and the life. No one comes to the Father except through me"
    John 14:6 (NIV)


  4. #4
    Join Date
    Jul 2007
    Location
    Swindon
    Posts
    990
    Tokens
    125

    Default

    there are a few on techtuts forums lying about its just trying to find them on there dynamicdrive have a few and pixel2life have a few but i google alot for what i need :S

  5. #5
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by NintendoNews View Post
    I've used s.a.us, but I'd like a smaller more dedicated script really I don't need all the features of it in most cases. However, I don't mind using it. Have you got any links to good pages explaining how to use Scriptaculous in conjunction with forms?

    Also, anyone got tutorials without using a library? (such as s.a.us and jQuery)
    Code:
    <script src="prototype.js" type="text/javascript"></script>
    <script src="scriptaculous.js" type="text/javascript"></script>
    Include your files.

    Code:
    <script type="text/javascript">
    function submitform () {
    var name = document.contact.name.value;
    var comments = document.contact.comments.value;
    var email = document.contact.email.value;
    new Ajax.Updater('result', 'contact.php?action=contact&name='+name+'&comments='+comments+'&email='+email+'',{onLoading:function(request){sendmail()},onComplete:function(request){handelrequest()}, insertion:Insertion.Bottom, asynchronous:true});
    }
            function sendmail() {
                //Make the Progress Bar Appear
            }
            function handelrequest() {
                    new Effect.SlideUp('formbox');
                    new Effect.Appear('result', { delay: 1 });
            }
    </script>
    Include this somewhere in the page ^^


    Code:
    <div id="result" style="display: none;"></div>      
            <div id="formbox">
             <form name="contact" class="box">
        <br>
        <strong>Name:<br>
        </strong> 
        <label>
        <input name="name" type="text" id="name" size="60">
        </label>
        <br>
        <br>
        <strong>Contact E-Mail: </strong><br>
        <input name="email" type="text" id="email" size="60">
        <br />
        <br />
        <strong>Comments:</strong><br />
        <label>
        <textarea name="comments" cols="55" rows="10" id="comments"></textarea>
        </label>
        <br />
        <br>
        <br>
        <input type="button" name="send" value=" Contact! " onClick="submitform();">
         <br />
      <br>
      </form>
      </div>
    This is the form

  6. #6
    Join Date
    Jul 2007
    Location
    Swindon
    Posts
    990
    Tokens
    125

    Default

    May i use that where needed?

  7. #7
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Sure

  8. #8
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Dentafrice, View Post
    Sure
    Thanks for your help This morning I put together an AJAX email sender, with all possible errors, email validity checking and AJAX sending



    i used to be NintendoNews. visit my blog or add me on twitter.
    need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!


    "I am the way, the truth, and the life. No one comes to the Father except through me"
    John 14:6 (NIV)


  9. #9
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    If you want you can use this is create a XMLHTTP object:

    Code:
    function createObj()
    {
    	var xmlhttp;
    	//works for all except IE6 and older
    	try
    	{
    		xmlhttp = new XMLHttpRequest();
    	}
    	catch(e)
    	{
    		var objVer = new Array("MSXML2.XMLHTTP.6.0",
    							   "MSXML2.XMLHTTP.5.0",
    							   "MSXML2.XMLHTTP.4.0",
    							   "MSXML2.XMLHTTP.3.0",
    							   "MSXML2.XMLHTTP",
    							   "Microsoft.XMLHTTP");
    		for (var i=0; i<objVer.length && !xmlhttp; i++)
    		{
    			try
    			{
    				xmlhttp = new ActiveXObject(objVer[i]);
    			}
    			catch (e) {}
    		}
    	}
    	if(!xmlhttp)
    	alert("Failed to create a valid XMLHttpRequest object. Please make sure your browser supports XMLHttpRequest or the XMLHTTP ActiveX Object");
    	else
    	return xmlhttp;
    }
    Taken from UserSystem's code.

    This is better than the normal ones as it attempts to create a object the is compaible with Opera/Firefox/IE7 first. Then trys to create the ActiveX object (It also trys diffrent versions, working from the latist down), rather than the other way round as the non-ActiveX object is better if the browser supports it.

Posting Permissions

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