TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Javascript, AJAX, E4X (http://www.talkphp.com/javascript-ajax-e4x/)
-   -   Mootools (http://www.talkphp.com/javascript-ajax-e4x/4189-mootools.html)

allworknoplay 04-25-2009 09:14 PM

Mootools
 
Ok so I downloaded Mootools...

All I have to do is include this outside script and that's it??

mootools-1.2.2-core-nc.js.txt


Then just start learning how to use its syntax?

Wildhoney 04-26-2009 01:02 AM

It should end in a JS extension, not a TXT extension, shouldn't it? But yes, once included you're good to go.

allworknoplay 04-26-2009 01:16 AM

Quote:

Originally Posted by Wildhoney (Post 23438)
It should end in a JS extension, not a TXT extension, shouldn't it? But yes, once included you're good to go.

Thanks!

That's what I thought, for some reason it downloaded as .txt extension but I will rename it to .js

They weren't kidding about being compact!

Tanax 04-26-2009 03:21 PM

Although I was a "Mootool'er" at first, I must recomend you to use jQuery. First of all, it's much more used, and there's alot more tutorials on it. In fact, if you check out blog.themeforest, and search for jQuery, there's a "jQuery for beginners" - a HUGE 15(16 actually) part series that will start you off from SCRATCH!

Anyways, if you still wanna go with Mootools, it's just to import it with a link tag in the HTML page.

allworknoplay 04-26-2009 03:45 PM

Quote:

Originally Posted by Tanax (Post 23447)
Although I was a "Mootool'er" at first, I must recomend you to use jQuery. First of all, it's much more used, and there's alot more tutorials on it. In fact, if you check out blog.themeforest, and search for jQuery, there's a "jQuery for beginners" - a HUGE 15(16 actually) part series that will start you off from SCRATCH!

Anyways, if you still wanna go with Mootools, it's just to import it with a link tag in the HTML page.

I've heard of jQuery all over the internet, not Mootools though except for here. Let me take a look at jQuery as well. You've always helped me out in the past so I trust your judgement.

I think there was another fellow in here too that suggested jQuery....

I hope it's not bloated!!!

sketchMedia 04-26-2009 04:00 PM

Quote:

I hope it's not bloated!!!
Not really.

I highly recommend it.

allworknoplay 04-26-2009 04:39 PM

Quote:

Originally Posted by sketchMedia (Post 23449)
Not really.

I highly recommend it.

checking it out now:

http://jquery.com/


It's amazing, whether it's jquery, mootools etc, we are learning yet another set of language instructions in order to program in another language....

Will there be a super jQuery to interact with jQuery so it can use JS functions?

haha....:-P

Enfernikus 04-26-2009 05:34 PM

Well the reason we learn this is to expedite the process of writing JS, for instance we were to want to send an ajax POST request via jQuery we'd simply do

Code:

$.post('file.php',{postInfo: dataVar}, function(data){ alert('foo'); });
how ever, if we were to do it by hand we'd have something like ( taken from a tutorial, didn't feel like writing it )

Code:

var http_request = false;
  function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
                // set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
        }
      } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
              http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
      }
      if (!http_request) {
        alert('Cannot create XMLHTTP instance');
        return false;
      }
     
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
  }

  function alertContents() {
      if (http_request.readyState == 4) {
        if (http_request.status == 200) {
            alert('foo');     
        } else {
            alert('There was a problem with the request.');
        }
      }
  }

 postString = 'postData=' + encodeURI(dataVar);
 makePOSTRequest('post.php', postString);

You see the advantage? Admittedly though, henceforth the makePOSTRequest function is available for the rest of the script but it is currently not as flexible as the one that jQuery has available

allworknoplay 04-26-2009 05:37 PM

Quote:

Originally Posted by Enfernikus (Post 23451)
Well the reason we learn this is to expedite the process of writing JS, for instance we were to want to send an ajax POST request via jQuery we'd simply do

Code:

$.post('file.php',{postInfo: dataVar}, function(data){ alert('foo'); });
how ever, if we were to do it by hand we'd have something like ( taken from a tutorial, didn't feel like writing it )

Code:

var http_request = false;
  function makePOSTRequest(url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
                // set type accordingly to anticipated content type
            //http_request.overrideMimeType('text/xml');
            http_request.overrideMimeType('text/html');
        }
      } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
              http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
      }
      if (!http_request) {
        alert('Cannot create XMLHTTP instance');
        return false;
      }
     
      http_request.onreadystatechange = alertContents;
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
  }

  function alertContents() {
      if (http_request.readyState == 4) {
        if (http_request.status == 200) {
            alert('foo');     
        } else {
            alert('There was a problem with the request.');
        }
      }
  }

 postString = 'postData=' + encodeURI(dataVar);
 makePOSTRequest('post.php', postString);

You see the advantage? Admittedly though, henceforth the makePOSTRequest function is available for the rest of the script but it is currently not as flexible as the one that jQuery has available


WOW!! Big difference....

Thanks....


I just hope the learning curve isn't steep for a JS newbie...

Tanax 04-26-2009 06:28 PM

Quote:

Originally Posted by allworknoplay (Post 23452)
I just hope the learning curve isn't steep for a JS newbie...

Check out the tutorials, it's actually really easy to understand!

gregor171 05-16-2009 11:27 PM

Quote:

Originally Posted by Tanax (Post 23447)
Although I was a "Mootool'er" at first, I must recomend you to use jQuery. First of all, it's much more used, and there's alot more tutorials on it. In fact, if you check out blog.themeforest, and search for jQuery, there's a "jQuery for beginners" - a HUGE 15(16 actually) part series that will start you off from SCRATCH!

Anyways, if you still wanna go with Mootools, it's just to import it with a link tag in the HTML page.

Have the same bio and I agree. jQuery ;-)

PS: I had some issues using complex Mootool's Ajax with Safari. Next they removed some functions with next version, that were clearly not OK from start, so thinks stopped working after upgrade. Feels like MS.

ETbyrne 05-17-2009 02:27 AM

Yeah jQuery is amazing, I've made a quite a few plugins for it.


All times are GMT. The time now is 05:20 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0